simplify polygon drawing
if it's a polygon, it's always a CMAP.
This commit is contained in:
parent
913eb30d8b
commit
e528ef7dfb
6
Makefile
6
Makefile
@ -73,7 +73,6 @@ $(1).pdf: layer2img.py Makefile $(2)
|
|||||||
python ./layer2img.py --outfile=$(1).pdf \
|
python ./layer2img.py --outfile=$(1).pdf \
|
||||||
$$(if $$($(1)_WIDTHDIV),--widthdiv=$$($(1)_WIDTHDIV)) \
|
$$(if $$($(1)_WIDTHDIV),--widthdiv=$$($(1)_WIDTHDIV)) \
|
||||||
$$(foreach i,1 2 3, \
|
$$(foreach i,1 2 3, \
|
||||||
$$(if $$($(1)_$$(i)CMAP),--group$$(i)-cmap="$$($(1)_$$(i)CMAP)") \
|
|
||||||
$$(if $$($(1)_$$(i)SELECT),--group$$(i)-select="$$($(1)_$$(i)SELECT)") \
|
$$(if $$($(1)_$$(i)SELECT),--group$$(i)-select="$$($(1)_$$(i)SELECT)") \
|
||||||
$$(if $$($(1)_$$(i)LINESTYLE),--group$$(i)-linestyle="$$($(1)_$$(i)LINESTYLE)") \
|
$$(if $$($(1)_$$(i)LINESTYLE),--group$$(i)-linestyle="$$($(1)_$$(i)LINESTYLE)") \
|
||||||
)
|
)
|
||||||
@ -84,26 +83,21 @@ $(foreach fig,$(RIVERS), $(eval $(call FIG_template,$(fig),.faux_test-rivers)))
|
|||||||
test-figures_1SELECT = wm_figures
|
test-figures_1SELECT = wm_figures
|
||||||
|
|
||||||
fig8-definition-of-a-bend_1SELECT = wm_debug where name='fig8' AND stage='bbends' AND gen=1
|
fig8-definition-of-a-bend_1SELECT = wm_debug where name='fig8' AND stage='bbends' AND gen=1
|
||||||
fig8-definition-of-a-bend_2CMAP = 1
|
|
||||||
fig8-definition-of-a-bend_2SELECT = wm_debug where name='fig8' AND stage='bbends-polygon' AND gen=1
|
fig8-definition-of-a-bend_2SELECT = wm_debug where name='fig8' AND stage='bbends-polygon' AND gen=1
|
||||||
|
|
||||||
fig5-gentle-inflection-before_WITHDIV = 2
|
fig5-gentle-inflection-before_WITHDIV = 2
|
||||||
fig5-gentle-inflection-before_1SELECT = wm_debug where name='fig5' AND stage='bbends' AND gen=1
|
fig5-gentle-inflection-before_1SELECT = wm_debug where name='fig5' AND stage='bbends' AND gen=1
|
||||||
fig5-gentle-inflection-before_2CMAP = 1
|
|
||||||
fig5-gentle-inflection-before_2SELECT = wm_debug where name='fig5' AND stage='bbends-polygon' AND gen=1
|
fig5-gentle-inflection-before_2SELECT = wm_debug where name='fig5' AND stage='bbends-polygon' AND gen=1
|
||||||
fig5-gentle-inflection-after_WITHDIV = 2
|
fig5-gentle-inflection-after_WITHDIV = 2
|
||||||
fig5-gentle-inflection-after_1SELECT = wm_debug where name='fig5' AND stage='cinflections' AND gen=1
|
fig5-gentle-inflection-after_1SELECT = wm_debug where name='fig5' AND stage='cinflections' AND gen=1
|
||||||
fig5-gentle-inflection-after_2SELECT = wm_debug where name='fig5' AND stage='cinflections-polygon' AND gen=1
|
fig5-gentle-inflection-after_2SELECT = wm_debug where name='fig5' AND stage='cinflections-polygon' AND gen=1
|
||||||
fig5-gentle-inflection-after_2CMAP = 1
|
|
||||||
|
|
||||||
inflection-1-gentle-inflection-before_WIDTHDIV = 2
|
inflection-1-gentle-inflection-before_WIDTHDIV = 2
|
||||||
inflection-1-gentle-inflection-before_1SELECT = wm_debug where name='inflection-1' AND stage='bbends' AND gen=1
|
inflection-1-gentle-inflection-before_1SELECT = wm_debug where name='inflection-1' AND stage='bbends' AND gen=1
|
||||||
inflection-1-gentle-inflection-before_2SELECT = wm_debug where name='inflection-1' AND stage='bbends-polygon' AND gen=1
|
inflection-1-gentle-inflection-before_2SELECT = wm_debug where name='inflection-1' AND stage='bbends-polygon' AND gen=1
|
||||||
inflection-1-gentle-inflection-before_2CMAP = 1
|
|
||||||
inflection-1-gentle-inflection-after_WIDTHDIV = 2
|
inflection-1-gentle-inflection-after_WIDTHDIV = 2
|
||||||
inflection-1-gentle-inflection-after_1SELECT = wm_debug where name='inflection-1' AND stage='cinflections' AND gen=1
|
inflection-1-gentle-inflection-after_1SELECT = wm_debug where name='inflection-1' AND stage='cinflections' AND gen=1
|
||||||
inflection-1-gentle-inflection-after_2SELECT = wm_debug where name='inflection-1' AND stage='cinflections-polygon' AND gen=1
|
inflection-1-gentle-inflection-after_2SELECT = wm_debug where name='inflection-1' AND stage='cinflections-polygon' AND gen=1
|
||||||
inflection-1-gentle-inflection-after_2CMAP = 1
|
|
||||||
|
|
||||||
fig6-selfcrossing-before_WIDTHDIV = 2
|
fig6-selfcrossing-before_WIDTHDIV = 2
|
||||||
fig6-selfcrossing-before_1SELECT = wm_debug where name='fig6' AND stage='bbends' AND gen=1
|
fig6-selfcrossing-before_1SELECT = wm_debug where name='fig6' AND stage='bbends' AND gen=1
|
||||||
|
20
layer2img.py
20
layer2img.py
@ -25,7 +25,6 @@ def parse_args():
|
|||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Convert a geometry to an image')
|
description='Convert a geometry to an image')
|
||||||
parser.add_argument('--group1-select', required=True)
|
parser.add_argument('--group1-select', required=True)
|
||||||
parser.add_argument('--group1-cmap', type=bool)
|
|
||||||
parser.add_argument('--group1-linestyle')
|
parser.add_argument('--group1-linestyle')
|
||||||
|
|
||||||
simplify = parser.add_mutually_exclusive_group()
|
simplify = parser.add_mutually_exclusive_group()
|
||||||
@ -34,7 +33,6 @@ def parse_args():
|
|||||||
parser.add_argument('--group1-chaikin', type=bool)
|
parser.add_argument('--group1-chaikin', type=bool)
|
||||||
|
|
||||||
parser.add_argument('--group2-select')
|
parser.add_argument('--group2-select')
|
||||||
parser.add_argument('--group2-cmap', type=bool)
|
|
||||||
parser.add_argument('--group2-linestyle')
|
parser.add_argument('--group2-linestyle')
|
||||||
simplify = parser.add_mutually_exclusive_group()
|
simplify = parser.add_mutually_exclusive_group()
|
||||||
simplify.add_argument('--group2-simplifydp', type=int)
|
simplify.add_argument('--group2-simplifydp', type=int)
|
||||||
@ -42,7 +40,6 @@ def parse_args():
|
|||||||
parser.add_argument('--group2-chaikin', type=bool)
|
parser.add_argument('--group2-chaikin', type=bool)
|
||||||
|
|
||||||
parser.add_argument('--group3-select')
|
parser.add_argument('--group3-select')
|
||||||
parser.add_argument('--group3-cmap', type=bool)
|
|
||||||
parser.add_argument('--group3-linestyle')
|
parser.add_argument('--group3-linestyle')
|
||||||
simplify = parser.add_mutually_exclusive_group()
|
simplify = parser.add_mutually_exclusive_group()
|
||||||
simplify.add_argument('--group3-simplifydp', type=int)
|
simplify.add_argument('--group3-simplifydp', type=int)
|
||||||
@ -65,10 +62,13 @@ def read_layer(select, width):
|
|||||||
return geopandas.read_postgis(sql, con=conn, geom_col='way1')
|
return geopandas.read_postgis(sql, con=conn, geom_col='way1')
|
||||||
|
|
||||||
|
|
||||||
def plot_args(color, maybe_cmap, maybe_linestyle):
|
def plot_args(geom, color, maybe_linestyle):
|
||||||
if maybe_cmap:
|
if geom is None:
|
||||||
r = {'cmap': CMAP}
|
return
|
||||||
else:
|
|
||||||
|
if geom.geom_type[0] == 'Polygon':
|
||||||
|
return {'cmap': CMAP}
|
||||||
|
|
||||||
r = {'color': color}
|
r = {'color': color}
|
||||||
if maybe_linestyle == 'invisible':
|
if maybe_linestyle == 'invisible':
|
||||||
r['color'] = (0, 0, 0, 0)
|
r['color'] = (0, 0, 0, 0)
|
||||||
@ -83,9 +83,9 @@ def main():
|
|||||||
group1 = read_layer(args.group1_select, width)
|
group1 = read_layer(args.group1_select, width)
|
||||||
group2 = read_layer(args.group2_select, width)
|
group2 = read_layer(args.group2_select, width)
|
||||||
group3 = read_layer(args.group3_select, width)
|
group3 = read_layer(args.group3_select, width)
|
||||||
c1 = plot_args(BLACK, args.group1_cmap, args.group1_linestyle)
|
c1 = plot_args(group1, BLACK, args.group1_linestyle)
|
||||||
c2 = plot_args(ORANGE, args.group2_cmap, args.group2_linestyle)
|
c2 = plot_args(group2, ORANGE, args.group2_linestyle)
|
||||||
c3 = plot_args(GREEN, args.group3_cmap, args.group3_linestyle)
|
c3 = plot_args(group3, GREEN, args.group3_linestyle)
|
||||||
|
|
||||||
rc('text', usetex=True)
|
rc('text', usetex=True)
|
||||||
fig, ax = plt.subplots()
|
fig, ax = plt.subplots()
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
\label{sec:abstract}
|
\label{sec:abstract}
|
||||||
Current open-source line generalization solutions have their roots in
|
Current open-source line generalization solutions have their roots in
|
||||||
mathematics and geometry, and are not fit for natural objects like rivers
|
mathematics and geometry, and are not fit for natural objects like rivers
|
||||||
and coastlines. This paper discusses our implementation of {\WM} algorithm
|
and coastlines. This paper discusses our implementation of {\WM}'s algorithm
|
||||||
under and open-source license, explains things that we would had
|
under and open-source license, explains things that we would had
|
||||||
appreciated in the original paper and compares our results to different
|
appreciated in the original paper and compares our results to different
|
||||||
generalization algorithms.
|
generalization algorithms.
|
||||||
|
Loading…
Reference in New Issue
Block a user