Wang–Müller line simplification algorithm in PostGIS
 
 
 
 
 
 
Go to file
Motiejus Jakštys ebafd19680 update README w.r.t. notable fork again 2021-08-10 17:46:32 +03:00
.gitignore postgis and postgresql logos 2021-05-28 07:38:38 +03:00
COPYING Add license 2021-05-19 23:10:04 +03:00
Dockerfile clean up files 2021-05-19 22:57:50 +03:00
Makefile re-add release.zip; add a notable fork 2021-08-10 17:45:34 +03:00
README.md update README w.r.t. notable fork again 2021-08-10 17:46:32 +03:00
aggregate-rivers.sql also import GDR50 and GDR250 2021-05-19 22:57:51 +03:00
amalgamate1.png amalgamation 2021-05-19 22:57:48 +03:00
bib.bib acknowledgments 2021-05-19 22:57:51 +03:00
db support in-container make 2021-05-19 22:57:50 +03:00
extract-and-generate gentler remove 2021-05-19 22:57:48 +03:00
gdr2pgsql also import GDR50 and GDR250 2021-05-19 22:57:51 +03:00
github-wm.png add github screenshot 2021-05-28 06:44:22 +03:00
in-container [in-container] fix directories 2021-05-19 23:53:06 +03:00
init.sql use smaller number of rivers during development 2021-05-19 22:57:49 +03:00
layer2img.py more consistent figure names 2021-05-19 22:57:52 +03:00
mj-msc-full.pdf stamp 2021-05-20 22:16:14 +03:00
mj-msc.tex update links to listings 2021-05-20 14:43:45 +03:00
openmap-wm-bad.png test harness 2021-05-19 22:57:51 +03:00
openmap-wm-good.png test harness 2021-05-19 22:57:51 +03:00
osi-logo.pdf a few more figures 2021-05-29 00:07:11 +03:00
postgis-logo.png postgis and postgresql logos 2021-05-28 07:38:38 +03:00
postgresql-logo.pdf postgis and postgresql logos 2021-05-28 07:38:38 +03:00
rivers-10.sql update all rivers from the new data source 2021-05-19 22:57:51 +03:00
rivers-50.sql update all rivers from the new data source 2021-05-19 22:57:51 +03:00
rivers-250.sql update all rivers from the new data source 2021-05-19 22:57:51 +03:00
salvis.png add salvis.png and README 2021-05-19 23:34:53 +03:00
slides-2021-03-29.txt remove demo 2021-05-19 22:57:46 +03:00
slides-2021-06-02.pdf Add final MSc thesis presentation 2021-06-02 08:43:35 +03:00
slides-2021-06-02.tex language 2021-06-01 21:31:11 +03:00
test-rivers.sql update README and docs 2021-05-19 23:09:05 +03:00
test.sql fix remaining bugs. gone from debug mode. 2021-05-19 22:57:51 +03:00
vars.awk test harness 2021-05-19 22:57:51 +03:00
visuals.sql default intersect_patience is 50 2021-05-23 16:28:17 +03:00
vu.pdf add generated vu.pdf 2021-05-19 22:57:49 +03:00
wang125-2.png more pics 2021-05-27 17:05:51 +03:00
wang125.png add wang125 2021-05-19 22:57:50 +03:00
wm.sql default intersect_patience is 50 2021-05-23 16:28:17 +03:00

README.md

WangMüller line generalization algorithm in PostGIS

This is WangMüller line generalization algorithm implementation in PostGIS. Following "Line generalization based on analysis of shape characteristics" by the same authors, 1998.

line simplification example

Status

The repository is no longer developed and archived. Notable forks:

If you have used this code as a basis and created an improved version, ping me, I will link it from this README.

Structure

There are 2 main pieces:

  • wm.sql, the implementation.
  • MSc thesis mj-msc-full.pdf with visual examples and known issues.
  • A few presentations.

It contains a few supporting files, notably:

  • tests.sql synthetic unit tests.
  • test-rivers.sql tests with real rivers.
  • Makefile glues everything together.
  • layer2img.py converts a PostGIS layer to an embeddable image.
  • aggregate-rivers.sql combines multiple river objects (linestrings or multilinestrings) to a single one.
  • init.sql initializes PostGIS database for running the tests.
  • rivers-*.sql are national dataset snapshots of rivers (Makefile contains code to update them).
  • ... and a few more files necessary to build the paper.

Running

make help lists the select commands for humans. As of writing:

# make help
clean              Clean the current working directory
clean-tables       Remove tables created during unit or rivers tests
help               Print this help message
mj-msc-full.pdf    Thesis for publishing
mj-msc-gray.pdf    Gray version, to inspect monochrome output
refresh-rivers     Refresh river data from national datasets
test-rivers        Rivers tests (slow)
test               Unit tests (fast)

To execute the algorithm, run:

  • make test for tests with synthetic data.
  • make test-rivers for tests with real rivers. You may adjust the rivers and data source (e.g. use a different country instead of Lithuania) by changing the Makefile and the test files. Left as an exercise for the reader.

N.B. the make test-rivers fails (see test-rivers.sql), because with higher dhalfcircle values, the unionized river (salvis) is going on top of itself, making the resulting geometry invalid during the process.

Building the paper (pdf)

# make -j mj-msc-full.pdf

mj-msc.tex results in mj-msc-full.pdf. This step needs quite a few or a container: see Dockerfile for dependencies or in-container to run it all in the container.

Credit

Nacionalinė Žemės Tarnyba for the river data sets.

License

GPLv2 or later.