add crossings

main
Motiejus Jakštys 2021-05-19 22:57:47 +03:00 committed by Motiejus Jakštys
parent 7073c15b88
commit 71c2a902a4
4 changed files with 27 additions and 7 deletions

View File

@ -122,6 +122,9 @@ fig6-self-crossing-before.pdf: layer2img.py Makefile .faux_test
--group1-where="name='fig6' AND stage='bbends' AND gen=1" \
--group2-table=wm_visuals \
--group2-where="name='fig6-baseline'" \
--group3-table=wm_visuals \
--group3-where="name='fig6-newline'" \
--group3-linestyle=dashed \
--outfile=$@
fig6-self-crossing-after.pdf: layer2img.py Makefile .faux_test

View File

@ -20,17 +20,20 @@ def parse_args():
parser.add_argument('--group1-table')
parser.add_argument('--group1-where')
parser.add_argument('--group1-cmap', type=bool)
parser.add_argument('--group1-linestyle')
parser.add_argument('--group2-table')
parser.add_argument('--group2-where')
parser.add_argument('--group2-cmap', type=bool)
parser.add_argument('--group2-linestyle')
parser.add_argument('--group3-table')
parser.add_argument('--group3-where')
parser.add_argument('--group3-cmap', type=bool)
parser.add_argument('--group3-linestyle')
parser.add_argument('--widthdiv',
default=1, type=float, help='Size divisor')
default=1, type=float, help='Width divisor')
parser.add_argument('-o', '--outfile', metavar='<file>')
parser.add_argument('--clip', type=float, nargs=4, metavar=BOUNDS)
@ -46,15 +49,24 @@ def read_layer(table, maybe_where=None):
sql += " WHERE %s" % maybe_where
return geopandas.read_postgis(sql, con=conn, geom_col='way')
def plot_args(color, maybe_cmap, maybe_linestyle):
if maybe_cmap:
r = {'cmap': CMAP}
else:
r = {'color': color}
if maybe_linestyle:
r['linestyle'] = maybe_linestyle
return r
def main():
args = parse_args()
group1 = read_layer(args.group1_table, args.group1_where)
group2 = read_layer(args.group2_table, args.group2_where)
group3 = read_layer(args.group3_table, args.group3_where)
c1 = {'cmap': CMAP} if args.group1_cmap else {'color': BLACK}
c2 = {'cmap': CMAP} if args.group2_cmap else {'color': ORANGE}
c3 = {'cmap': CMAP} if args.group3_cmap else {'color': GREEN}
c1 = plot_args(BLACK, args.group1_cmap, args.group1_linestyle)
c2 = plot_args(ORANGE, args.group2_cmap, args.group2_linestyle)
c3 = plot_args(GREEN, args.group3_cmap, args.group3_linestyle)
rc('text', usetex=True)
fig, ax = plt.subplots()

View File

@ -184,6 +184,8 @@ open-source tools is an important foundation for future cartographic
experimentation and development, thus it it benefits the cartographic society
as a whole.
<TODO: expand on each paper>
\section{Methodology}
\label{sec:methodology}

View File

@ -57,10 +57,13 @@ insert into wm_demo (name, way) select name, ST_SimplifyWM(way, name) from wm_fi
drop table if exists wm_visuals;
create table wm_visuals (name text, way geometry);
do $$
declare fig6 geometry;
declare fig6b1 geometry;
declare fig6b2 geometry;
begin
select way from wm_debug where name='fig6' and stage='bbends' and gen=1 into fig6 limit 1 offset 2;
insert into wm_visuals (name, way) values('fig6-baseline', st_makeline(st_startpoint(fig6), st_endpoint(fig6)));
select way from wm_debug where name='fig6' and stage='bbends' and gen=1 into fig6b1 limit 1 offset 0;
select way from wm_debug where name='fig6' and stage='bbends' and gen=1 into fig6b2 limit 1 offset 2;
insert into wm_visuals (name, way) values('fig6-baseline', st_makeline(st_startpoint(fig6b2), st_endpoint(fig6b2)));
insert into wm_visuals (name, way) values('fig6-newline', st_makeline(st_endpoint(fig6b1), st_endpoint(fig6b2)));
end $$ language plpgsql;
do $$