Wang–Müller line simplification algorithm in PostGIS
Go to file
2021-05-19 22:57:49 +03:00
aggregate-rivers.sql labeled code listings 2021-05-19 22:57:49 +03:00
amalgamate1.png amalgamation 2021-05-19 22:57:48 +03:00
bib.bib fix bib.bib 2021-05-19 22:57:49 +03:00
db log sql statements 2021-05-19 22:57:46 +03:00
extract-and-generate gentler remove 2021-05-19 22:57:48 +03:00
init.sql always order wm_debug by insertion time 2021-05-19 22:57:49 +03:00
layer2img.py better formulae 2021-05-19 22:57:49 +03:00
Makefile rename some files, add README 2021-05-19 22:57:49 +03:00
mj-msc.tex style 2021-05-19 22:57:49 +03:00
notes.txt self-crossing bugfix 2021-05-19 22:57:47 +03:00
README.md update README 2021-05-19 22:57:49 +03:00
rivers.sql Add Merkys 2021-05-19 22:57:48 +03:00
slides-2021-03-29.txt remove demo 2021-05-19 22:57:46 +03:00
test-rivers.sql rename some files, add README 2021-05-19 22:57:49 +03:00
test.sql rename some files, add README 2021-05-19 22:57:49 +03:00
vars.awk average curvature and isolated bend 2021-05-19 22:57:47 +03:00
vu.pdf add generated vu.pdf 2021-05-19 22:57:49 +03:00
wm.sql add parameter table 2021-05-19 22:57:49 +03:00

WangMüller algorithm in PostGIS

This is a work-in-progress implementation following "Line generalization based on analysis of shape characteristics" by Wang and Müller, 1998 paper.

Structure

Detailed implementation description: mj-msc.tex. It is describing in detail what is implemented and what isn't, and why.

Algorithm itself: wm.sql. This is the main file you probably want to look at.

Synthetic tests are in tests.sql. They are exercising various pieces of the algorithm and asserting the results are what expect them to be.

Tests with real rivers are in test-rivers.sql.

Makefile glues everything together.

Executing the algorithm

$ make help
mj-msc-full.pdf    Thesis for publishing
test               Unit tests (fast)
test-rivers        Rivers tests (slow)
clean              Clean the current working directory
clean-tables       Remove tables created during unit or rivers tests
help               Print this help message
wc                 Character and page count
refresh-rivers     Refresh rivers.sql from Open Street Maps

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.

Building the paper (pdf)

$ make -j$(nproc) mj-msc-full.pdf

mj-msc.tex results in mj-msc-full.pdf, which will be at some point published. It needs quite a few dependencies, including a functioning Docker environment.

License

GPL 2.0 or later. Same as QGIS and PostGIS.