wm

Wang–Müller line generalization algorithm in PostGIS
Log | Files | Refs | README | LICENSE

commit 79a31bd2fdc680d5fe9db40072d7f38826bfa29c (tree)
parent ae76bc434429a447f42187632ad55027796a1c5b
Author: Motiejus Jakštys <motiejus@jakstys.lt>
Date:   Wed, 19 May 2021 22:57:48 +0300

add some intersections

Diffstat:
MMakefile | 10+++++-----
Minit.sql | 2+-
Dtests-integration.sql | 15---------------
Atests-rivers.sql | 29+++++++++++++++++++++++++++++
4 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/Makefile b/Makefile @@ -41,8 +41,8 @@ mj-msc-full.pdf: mj-msc.pdf version.inc.tex $(ARCHIVABLES) ## Thesis for publish .PHONY: test test: .faux_test ## Unit tests (fast) -.PHONY: test-integration -test-integration: .faux_test-integration ## Integration tests (slow) +.PHONY: test-rivers +test-rivers: .faux_test-rivers ## Rivers tests (slow) .PHONY: slides slides: $(SLIDES) @@ -113,7 +113,7 @@ selfcrossing-1-after_2SELECT = wm_debug where name='selfcrossing-1' AND stage='b selfcrossing-1-after_2LINESTYLE = invisible -.faux_test-integration: tests-integration.sql wm.sql .faux_db +.faux_test-rivers: tests-rivers.sql wm.sql .faux_db ./db -f $< touch $@ @@ -161,7 +161,7 @@ mj-msc-gray.pdf: mj-msc.pdf .PHONY: clean clean: ## Clean the current working directory -./db stop - -rm -r .faux_test .faux_aggregate-rivers .faux_test-integration .faux_db \ + -rm -r .faux_test .faux_aggregate-rivers .faux_test-rivers .faux_db \ version.inc.tex vars.inc.tex version.aux version.fdb_latexmk \ _minted-mj-msc \ $(shell git ls-files -o mj-msc*) \ @@ -169,7 +169,7 @@ clean: ## Clean the current working directory $(SLIDES) .PHONY: clean-tables -clean-tables: ## Remove tables created during unit or integration tests +clean-tables: ## Remove tables created during unit or rivers tests ./db -c '\dt wm_*' | awk '/_/{print "drop table "$$3";"}' | ./db -f - -rm .faux_db diff --git a/init.sql b/init.sql @@ -1,4 +1,4 @@ --- This file initializes tables for unit and integration tests. +-- This file initializes tables for unit and river tests. -- ST_SimplifyWM, when dbgname is non-empty, expects `wm_debug` table to be -- created. diff --git a/tests-integration.sql b/tests-integration.sql @@ -1,15 +0,0 @@ -\i wm.sql - -do $$ -declare - npoints bigint; - secs bigint; -begin - select * from ST_SimplifyWM_Estimate((select st_union(way) from wm_rivers)) into npoints, secs; - raise notice 'Total points: %', npoints; - raise notice 'Expected duration: %s (+-%s)', ceil(secs), floor(secs*.5); -end $$ language plpgsql; - -delete from wm_debug where name in (select distinct name from wm_rivers); -delete from wm_demo where name in (select distinct name from wm_rivers); -insert into wm_demo (name, way) select name, ST_SimplifyWM(way, name) from wm_rivers; diff --git a/tests-rivers.sql b/tests-rivers.sql @@ -0,0 +1,29 @@ +\i wm.sql + +insert into wm_visuals(name, way) values('salcia-visincia', + st_closestpoint( + (select way from wm_rivers where name='Šalčia'), + (select way from wm_rivers where name='Visinčia') + ) +); + +insert into wm_visuals(name, way) values('nemunas-merkys', + st_closestpoint( + (select way from wm_rivers where name='Nemunas'), + (select way from wm_rivers where name='Merkys') + ) +); + +do $$ +declare + npoints bigint; + secs bigint; +begin + select * from ST_SimplifyWM_Estimate((select st_union(way) from wm_rivers)) into npoints, secs; + raise notice 'Total points: %', npoints; + raise notice 'Expected duration: %s (+-%s)', ceil(secs), floor(secs*.5); +end $$ language plpgsql; + +delete from wm_debug where name in (select distinct name from wm_rivers); +delete from wm_demo where name in (select distinct name from wm_rivers); +insert into wm_demo (name, way) select name, ST_SimplifyWM(way, name) from wm_rivers;