From 92972694eea95b725b5c8fa2105ee32f406b80ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 19 May 2021 22:57:47 +0300 Subject: [PATCH] add fig8 --- Makefile | 8 ++++---- layer2img.py | 5 ++--- tests.sql | 4 +++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index d6959d0..bfb6c1e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/layer2img.py b/layer2img.py index 9b23184..9a7be48 100644 --- a/layer2img.py +++ b/layer2img.py @@ -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) diff --git a/tests.sql b/tests.sql index 9a8a5b0..89e688f 100644 --- a/tests.sql +++ b/tests.sql @@ -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)'));