rivers are blue
This commit is contained in:
parent
28b6752e0a
commit
9439ca8d79
@ -1,7 +1,7 @@
|
|||||||
CROSSING=622916 6109267 626066 6111487 # xmin ymin xmax ymax
|
CROSSING=622916 6109267 626066 6111487 # xmin ymin xmax ymax
|
||||||
ZEIMENA_TOLERANCES = 100 125 250 500 1000 2000 4000
|
ZEIMENA_TOLERANCES = 128 256 512 1024 2048 4096
|
||||||
SINEWAVE_TOLERANCES = 1 20 30 40
|
SINEWAVE_TOLERANCES = 1 20 30 40
|
||||||
CROSSING_TOLERANCES = 125 250 500
|
CROSSING_TOLERANCES = 64 128 256
|
||||||
GEN1 = $(addsuffix .pdf, \
|
GEN1 = $(addsuffix .pdf, \
|
||||||
$(addprefix sinewave-douglas-,$(SINEWAVE_TOLERANCES)) \
|
$(addprefix sinewave-douglas-,$(SINEWAVE_TOLERANCES)) \
|
||||||
$(addprefix sinewave-visvalingam-,$(SINEWAVE_TOLERANCES)) \
|
$(addprefix sinewave-visvalingam-,$(SINEWAVE_TOLERANCES)) \
|
||||||
@ -21,25 +21,25 @@ db/.faux_$(1)-$(2)-%: $(2).sql db/.faux_ready
|
|||||||
./managedb -- --echo-all -v ON_ERROR_STOP=1 -v src=$(1) -v tolerance=$$* -v tbl=$(1)_$(2)_$$* -f $(2).sql
|
./managedb -- --echo-all -v ON_ERROR_STOP=1 -v src=$(1) -v tolerance=$$* -v tbl=$(1)_$(2)_$$* -f $(2).sql
|
||||||
touch $$@
|
touch $$@
|
||||||
$(1)-$(2)-%.pdf: layer2img.py db/.faux_$(1)-$(2)-%
|
$(1)-$(2)-%.pdf: layer2img.py db/.faux_$(1)-$(2)-%
|
||||||
./layer2img.py --table=$(1)_$(2)_$$* --size=$(3) --outfile $$@
|
./layer2img.py --group2-table=$(1)_$(2)_$$* --size=$(3) --outfile $$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define algo2overlay
|
define algo2overlay
|
||||||
crossing-$(1)-$(2)-%.pdf: layer2img.py db/.faux_$(1)-$(2)-%
|
crossing-$(1)-$(2)-%.pdf: layer2img.py db/.faux_$(1)-$(2)-%
|
||||||
./layer2img.py $(3) --table=$(1)_$(2)_$$* --overlay-table=$(1) --outfile $$@
|
./layer2img.py $(3) --group1-table=$(1) --group2-table=$(1)_$(2)_$$* --outfile $$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define gpkg2pdf
|
define gpkg2pdf
|
||||||
$(1): $(2) ./layer2img.py
|
$(1): $(2) ./layer2img.py
|
||||||
./layer2img.py $(3) --infile=$$< --outfile $(1)
|
./layer2img.py $(3) --group1-infile=$$< --outfile $(1)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call algo2img,sinewave,douglas,60x24))
|
$(eval $(call algo2img,sinewave,douglas,60x24))
|
||||||
$(eval $(call algo2img,sinewave,visvalingam,60x24))
|
$(eval $(call algo2img,sinewave,visvalingam,60x24))
|
||||||
$(eval $(call algo2img,zeimena,douglas,210x297))
|
$(eval $(call algo2img,zeimena,douglas,210x297))
|
||||||
$(eval $(call algo2img,zeimena,visvalingam,210x297))
|
$(eval $(call algo2img,zeimena,visvalingam,210x297))
|
||||||
$(eval $(call gpkg2pdf,sinewave.pdf,sinewave.gpkg,,--size=52x12))
|
$(eval $(call gpkg2pdf,sinewave.pdf,sinewave.gpkg,,--size=60x24))
|
||||||
$(eval $(call gpkg2pdf,zeimena.pdf,zeimena.gpkg rectangle.gpkg,--size=67x95 --overlay-infile rectangle.gpkg))
|
$(eval $(call gpkg2pdf,zeimena.pdf,zeimena.gpkg rectangle.gpkg,--size=67x95 --group2-infile rectangle.gpkg))
|
||||||
$(eval $(call gpkg2pdf,crossing.pdf,zeimena.gpkg,--size=105x74 --clip $(CROSSING)))
|
$(eval $(call gpkg2pdf,crossing.pdf,zeimena.gpkg,--size=105x74 --clip $(CROSSING)))
|
||||||
$(eval $(call algo2overlay,zeimena,douglas,--size 297x210 --clip $(CROSSING)))
|
$(eval $(call algo2overlay,zeimena,douglas,--size 297x210 --clip $(CROSSING)))
|
||||||
$(eval $(call algo2overlay,zeimena,visvalingam,--size 297x210 --clip $(CROSSING)))
|
$(eval $(call algo2overlay,zeimena,visvalingam,--size 297x210 --clip $(CROSSING)))
|
||||||
|
@ -24,17 +24,17 @@ def plt_size(string):
|
|||||||
def parse_args():
|
def parse_args():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Convert geopackage to an image')
|
description='Convert geopackage to an image')
|
||||||
ingroup = parser.add_mutually_exclusive_group(required=True)
|
group1 = parser.add_mutually_exclusive_group()
|
||||||
ingroup.add_argument('--infile')
|
group1.add_argument('--group1-infile')
|
||||||
ingroup.add_argument('--table')
|
group1.add_argument('--group1-table')
|
||||||
parser.add_argument('-o', '--outfile', metavar='<file>')
|
parser.add_argument('-o', '--outfile', metavar='<file>')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--size', type=plt_size, help='Figure size in mm (WWxHH)')
|
'--size', type=plt_size, help='Figure size in mm (WWxHH)')
|
||||||
parser.add_argument( '--clip', type=float, nargs=4, metavar=BOUNDS)
|
parser.add_argument( '--clip', type=float, nargs=4, metavar=BOUNDS)
|
||||||
|
|
||||||
overlay = parser.add_mutually_exclusive_group()
|
group2 = parser.add_mutually_exclusive_group()
|
||||||
overlay.add_argument('--overlay-infile', type=str)
|
group2.add_argument('--group2-infile', type=str)
|
||||||
overlay.add_argument('--overlay-table', type=str)
|
group2.add_argument('--group2-table', type=str)
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
@ -49,20 +49,21 @@ def read_layer(maybe_table, maybe_file):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
primary = read_layer(args.table, args.infile)
|
group1 = read_layer(args.group1_table, args.group1_infile)
|
||||||
overlay = read_layer(args.overlay_table, args.overlay_infile)
|
group2 = read_layer(args.group2_table, args.group2_infile)
|
||||||
|
|
||||||
rc('text', usetex=True)
|
rc('text', usetex=True)
|
||||||
fig, ax = plt.subplots()
|
fig, ax = plt.subplots()
|
||||||
if args.size:
|
if args.size:
|
||||||
fig.set_size_inches(args.size)
|
fig.set_size_inches(args.size)
|
||||||
primary.plot(ax=ax, color=PURPLE)
|
|
||||||
if c := args.clip:
|
if c := args.clip:
|
||||||
ax.set_xlim(left=c[0], right=c[2])
|
ax.set_xlim(left=c[0], right=c[2])
|
||||||
ax.set_ylim(bottom=c[1], top=c[3])
|
ax.set_ylim(bottom=c[1], top=c[3])
|
||||||
|
|
||||||
if overlay is not None:
|
if group1 is not None:
|
||||||
overlay.plot(ax=ax, color=ORANGE)
|
group1.plot(ax=ax, color=PURPLE)
|
||||||
|
if group2 is not None:
|
||||||
|
group2.plot(ax=ax, color=ORANGE)
|
||||||
|
|
||||||
ax.axis('off')
|
ax.axis('off')
|
||||||
ax.margins(0, 0)
|
ax.margins(0, 0)
|
||||||
|
@ -207,29 +207,29 @@ bends on the original map should be retained.
|
|||||||
Douglas \& Peucker &
|
Douglas \& Peucker &
|
||||||
Visvalingam-Whyatt \tabularnewline \hline
|
Visvalingam-Whyatt \tabularnewline \hline
|
||||||
|
|
||||||
125/15625 &
|
128/15625 &
|
||||||
\includegraphics[width=\linewidth]{zeimena-douglas-125} &
|
\includegraphics[width=\linewidth]{zeimena-douglas-128} &
|
||||||
\includegraphics[width=\linewidth]{zeimena-visvalingam-125} \tabularnewline \hline
|
\includegraphics[width=\linewidth]{zeimena-visvalingam-128} \tabularnewline \hline
|
||||||
|
|
||||||
250/62500 &
|
256/62560 &
|
||||||
\includegraphics[width=.5\linewidth]{zeimena-douglas-250} &
|
\includegraphics[width=.5\linewidth]{zeimena-douglas-256} &
|
||||||
\includegraphics[width=.5\linewidth]{zeimena-visvalingam-250} \tabularnewline \hline
|
\includegraphics[width=.5\linewidth]{zeimena-visvalingam-256} \tabularnewline \hline
|
||||||
|
|
||||||
500/250000 &
|
512/251200 &
|
||||||
\includegraphics[width=.25\linewidth]{zeimena-douglas-500} &
|
\includegraphics[width=.25\linewidth]{zeimena-douglas-512} &
|
||||||
\includegraphics[width=.25\linewidth]{zeimena-visvalingam-500} \tabularnewline \hline
|
\includegraphics[width=.25\linewidth]{zeimena-visvalingam-512} \tabularnewline \hline
|
||||||
|
|
||||||
1000/1000000 &
|
1024/1024000 &
|
||||||
\includegraphics[width=.125\linewidth]{zeimena-douglas-1000} &
|
\includegraphics[width=.125\linewidth]{zeimena-douglas-1024} &
|
||||||
\includegraphics[width=.125\linewidth]{zeimena-visvalingam-1000} \tabularnewline \hline
|
\includegraphics[width=.125\linewidth]{zeimena-visvalingam-1024} \tabularnewline \hline
|
||||||
|
|
||||||
2000/4000000 &
|
2048/4000000 &
|
||||||
\includegraphics[width=.0625\linewidth]{zeimena-douglas-2000} &
|
\includegraphics[width=.0625\linewidth]{zeimena-douglas-2048} &
|
||||||
\includegraphics[width=.0625\linewidth]{zeimena-visvalingam-2000} \tabularnewline \hline
|
\includegraphics[width=.0625\linewidth]{zeimena-visvalingam-2048} \tabularnewline \hline
|
||||||
|
|
||||||
4000/16000000 &
|
4096/16000000 &
|
||||||
\includegraphics[width=.0625\linewidth]{zeimena-douglas-4000} &
|
\includegraphics[width=.0625\linewidth]{zeimena-douglas-4096} &
|
||||||
\includegraphics[width=.0625\linewidth]{zeimena-visvalingam-4000} \tabularnewline \hline
|
\includegraphics[width=.0625\linewidth]{zeimena-visvalingam-4096} \tabularnewline \hline
|
||||||
\end{tabularx}
|
\end{tabularx}
|
||||||
\caption{{\DP} and {\VW} on Žeimena}
|
\caption{{\DP} and {\VW} on Žeimena}
|
||||||
\label{tab:comparison-zeimena}
|
\label{tab:comparison-zeimena}
|
||||||
@ -240,22 +240,23 @@ Let's zoom in to the river crossing area for some of the algorithms.
|
|||||||
|
|
||||||
\begin{figure}[h]
|
\begin{figure}[h]
|
||||||
\renewcommand{\tabularxcolumn}[1]{>{\center\small}m{#1}}
|
\renewcommand{\tabularxcolumn}[1]{>{\center\small}m{#1}}
|
||||||
\begin{tabularx}{\textwidth}{ p{1.5cm} | X | X | }
|
\begin{tabularx}{\textwidth}{ p{2.1cm} | X | X | }
|
||||||
Tolerance DP/VW &
|
Tolerance DP/VW &
|
||||||
Douglas \& Peucker &
|
Douglas \& Peucker &
|
||||||
Visvalingam-Whyatt \tabularnewline \hline
|
Visvalingam-Whyatt \tabularnewline \hline
|
||||||
|
|
||||||
|
64/4096 &
|
||||||
|
\includegraphics[width=\linewidth]{crossing-zeimena-douglas-64} &
|
||||||
|
\includegraphics[width=\linewidth]{crossing-zeimena-visvalingam-64} \tabularnewline \hline
|
||||||
|
|
||||||
125/15625 &
|
125/15625 &
|
||||||
\includegraphics[width=\linewidth]{crossing-zeimena-douglas-125} &
|
\includegraphics[width=\linewidth]{crossing-zeimena-douglas-128} &
|
||||||
\includegraphics[width=\linewidth]{crossing-zeimena-visvalingam-125} \tabularnewline \hline
|
\includegraphics[width=\linewidth]{crossing-zeimena-visvalingam-128} \tabularnewline \hline
|
||||||
|
|
||||||
250/62500 &
|
250/62500 &
|
||||||
\includegraphics[width=.5\linewidth]{crossing-zeimena-douglas-250} &
|
\includegraphics[width=\linewidth]{crossing-zeimena-douglas-256} &
|
||||||
\includegraphics[width=.5\linewidth]{crossing-zeimena-visvalingam-250} \tabularnewline \hline
|
\includegraphics[width=\linewidth]{crossing-zeimena-visvalingam-256} \tabularnewline \hline
|
||||||
|
|
||||||
500/250000 &
|
|
||||||
\includegraphics[width=.25\linewidth]{crossing-zeimena-douglas-500} &
|
|
||||||
\includegraphics[width=.25\linewidth]{crossing-zeimena-visvalingam-500} \tabularnewline \hline
|
|
||||||
\end{tabularx}
|
\end{tabularx}
|
||||||
\caption{{\DP} and {\VW} on river crossing area}
|
\caption{{\DP} and {\VW} on river crossing area}
|
||||||
\label{tab:comparison-zoomed}
|
\label{tab:comparison-zoomed}
|
||||||
|
Loading…
Reference in New Issue
Block a user