diff --git a/IV/Makefile b/IV/Makefile index 149919f..374de69 100644 --- a/IV/Makefile +++ b/IV/Makefile @@ -13,6 +13,8 @@ SCALEDWIDTH = $(shell awk '/^TEXTWIDTH_CM/{print 25000/100*$$3}' layer2img.py) NON_ARCHIVABLES = notes.txt referatui.txt slides-2021-03-29.txt ARCHIVABLES = $(filter-out $(NON_ARCHIVABLES),$(shell git ls-files .)) +LISTINGS = aggregate-rivers.sql wm.sql extract-and-generate + FIGURES = \ test-figures \ fig8-definition-of-a-bend \ @@ -66,8 +68,8 @@ slides: $(SLIDES) # The report, quick version ########################### -mj-msc.pdf: mj-msc.tex version.inc.tex vars.inc.tex extract-and-generate bib.bib \ - $(addsuffix .pdf,$(FIGURES)) $(addsuffix .pdf,$(RIVERS)) +mj-msc.pdf: mj-msc.tex version.inc.tex vars.inc.tex bib.bib \ + $(LISTINGS) $(addsuffix .pdf,$(FIGURES)) $(addsuffix .pdf,$(RIVERS)) latexmk -shell-escape -g -pdf $< ############################ diff --git a/IV/aggregate-rivers.sql b/IV/aggregate-rivers.sql index 22d7924..7fd1ec0 100644 --- a/IV/aggregate-rivers.sql +++ b/IV/aggregate-rivers.sql @@ -1,6 +1,10 @@ /* Aggregates rivers by name and proximity. */ drop function if exists aggregate_rivers; -create function aggregate_rivers() returns table(osm_id bigint, name text, way geometry) as $$ +create function aggregate_rivers() returns table( + osm_id bigint, + name text, + way geometry +) as $$ declare c record; cc record; @@ -12,7 +16,11 @@ begin changed = true; while changed loop changed = false; - for cc in (select * from wm_rivers_tmp a where a.name = c.name and st_dwithin(a.way, c.way, 500)) loop + for cc in ( + select * from wm_rivers_tmp a where + a.name = c.name and + st_dwithin(a.way, c.way, 500) + ) loop c.way = st_linemerge(st_union(c.way, cc.way)); delete from wm_rivers_tmp a where a.osm_id = cc.osm_id; changed = true; @@ -36,5 +44,7 @@ insert into wm_rivers_tmp where waterway in ('river', 'stream', 'canal') and :where; drop table if exists wm_rivers; -create table wm_rivers as (select * from aggregate_rivers() where st_length(way) >= 50000); +create table wm_rivers as ( + select * from aggregate_rivers() where st_length(way) >= 50000 +); drop table wm_rivers_tmp; diff --git a/IV/mj-msc.tex b/IV/mj-msc.tex index 337eb35..039cedd 100644 --- a/IV/mj-msc.tex +++ b/IV/mj-msc.tex @@ -854,10 +854,10 @@ Like explained in section~\ref{sec:reproducing-the-paper}, illustrations in \inputcode{bash}{extract-and-generate} -\subsection{\texttt{ST\_SimplifyWV}} +\subsection{Function \texttt{ST\_SimplifyWV}} \inputcode{postgresql}{wm.sql} -\subsection{\texttt{aggregate\_rivers}} +\subsection{Function \texttt{aggregate\_rivers}} \inputcode{postgresql}{aggregate-rivers.sql} \end{appendices}