This commit is contained in:
Motiejus Jakštys 2021-05-19 22:57:47 +03:00 committed by Motiejus Jakštys
parent f3bc22b5ba
commit 92972694ee
3 changed files with 9 additions and 8 deletions

View File

@ -46,13 +46,13 @@ mj-msc-full.pdf: mj-msc.pdf version.tex $(ARCHIVABLES)
test-figures.pdf: layer2img.py .faux_test
python ./layer2img.py --group1-table=wm_figures --outfile=$@
fig-definition-of-a-bend.pdf: layer2img.py Makefile .faux_test
fig8-definition-of-a-bend.pdf: layer2img.py Makefile .faux_test
python ./layer2img.py \
--group1-table=wm_debug \
--group1-cmap=1 \
--group1-where="name='fig6' AND stage='bbends-polygon' AND gen=1" \
--group1-table=wm_debug \
--group1-where="name='fig8' AND stage='bbends-polygon' AND gen=1" \
--group2-table=wm_debug \
--group2-where="name='fig6' AND stage='bbends' AND gen=1" \
--group2-where="name='fig8' AND stage='bbends' AND gen=1" \
--outfile=$@
.faux_test: tests.sql wm.sql .faux_db

View File

@ -8,10 +8,9 @@ from matplotlib import rc
INCH = 25.4 # mm
BOUNDS = ('xmin', 'ymin', 'xmax', 'ymax')
GREEN, ORANGE, PURPLE = '#1b9e77', '#d95f02', '#7570b3'
BLACK, GREEN, ORANGE, PURPLE = '#000000', '#1b9e77', '#d95f02', '#7570b3'
PSQL_CREDS = "host=127.0.0.1 dbname=osm user=osm password=osm"
def plt_size(string):
if not string:
return None
@ -60,7 +59,7 @@ def main():
group2 = read_layer(args.group2_table, args.group2_where)
group3 = read_layer(args.group3_table, args.group3_where)
c1 = {'cmap': 'coolwarm'} if args.group1_cmap else {'color': ORANGE}
c2 = {'cmap': 'coolwarm'} if args.group2_cmap else {'color': PURPLE}
c2 = {'cmap': 'coolwarm'} if args.group2_cmap else {'color': BLACK}
c3 = {'cmap': 'coolwarm'} if args.group3_cmap else {'color': GREEN}
rc('text', usetex=True)

View File

@ -28,8 +28,10 @@ create table wm_debug(stage text, name text, gen bigint, nbend bigint, way geome
drop table if exists wm_figures;
create table wm_figures (name text, way geometry);
-- add fig8.gpkg to postgis:
-- ogr2ogr -update -f PostgreSQL PG:"host=127.0.0.1 user=osm password=osm dbname=osm" fig8.gpkg
-- to "normalize" a new line when it's in `f`:
-- select st_astext(st_snaptogrid(st_transscale(geometry, 80, 130, .3, .3), 1)) from f;
-- select st_astext(st_snaptogrid(st_transscale(geometry, -19.5, .016, 4000, 4000), 1)) from f;
insert into wm_figures (name, way) values ('fig3',ST_GeomFromText('LINESTRING(0 0,12 0,13 4,20 2,20 0,32 0,33 10,38 16,43 15,44 10,44 0,60 0)'));
insert into wm_figures (name, way) values ('fig3-1',ST_GeomFromText('LINESTRING(0 0,12 0,13 4,20 2,20 0,32 0,33 10,38 16,43 15,44 10,44 0)'));
insert into wm_figures (name, way) values ('fig5',ST_GeomFromText('LINESTRING(0 39,19 52,27 77,26 104,41 115,49 115,65 103,65 75,53 45,63 15,91 0)'));