This commit is contained in:
Motiejus Jakštys 2021-04-11 09:34:44 +03:00
parent 6134a333c1
commit 1bf1af56c0
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 test-figures.pdf: layer2img.py .faux_test
python ./layer2img.py --group1-table=wm_figures --outfile=$@ 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 \ python ./layer2img.py \
--group1-table=wm_debug \
--group1-cmap=1 \ --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-table=wm_debug \
--group2-where="name='fig6' AND stage='bbends' AND gen=1" \ --group2-where="name='fig8' AND stage='bbends' AND gen=1" \
--outfile=$@ --outfile=$@
.faux_test: tests.sql wm.sql .faux_db .faux_test: tests.sql wm.sql .faux_db

View File

@ -8,10 +8,9 @@ from matplotlib import rc
INCH = 25.4 # mm INCH = 25.4 # mm
BOUNDS = ('xmin', 'ymin', 'xmax', 'ymax') 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" PSQL_CREDS = "host=127.0.0.1 dbname=osm user=osm password=osm"
def plt_size(string): def plt_size(string):
if not string: if not string:
return None return None
@ -60,7 +59,7 @@ def main():
group2 = read_layer(args.group2_table, args.group2_where) group2 = read_layer(args.group2_table, args.group2_where)
group3 = read_layer(args.group3_table, args.group3_where) group3 = read_layer(args.group3_table, args.group3_where)
c1 = {'cmap': 'coolwarm'} if args.group1_cmap else {'color': ORANGE} 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} c3 = {'cmap': 'coolwarm'} if args.group3_cmap else {'color': GREEN}
rc('text', usetex=True) 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; drop table if exists wm_figures;
create table wm_figures (name text, way geometry); 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`: -- 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',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 ('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)')); 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)'));