Wang–Müller line simplification algorithm in PostGIS
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Motiejus Jakštys ebafd19680 update README w.r.t. notable fork again 2 years ago
.gitignore postgis and postgresql logos 2 years ago
COPYING Add license 2 years ago
Dockerfile clean up files 2 years ago
Makefile re-add release.zip; add a notable fork 2 years ago
README.md update README w.r.t. notable fork again 2 years ago
aggregate-rivers.sql also import GDR50 and GDR250 2 years ago
amalgamate1.png amalgamation 2 years ago
bib.bib acknowledgments 2 years ago
db support in-container make 2 years ago
extract-and-generate gentler remove 2 years ago
gdr2pgsql also import GDR50 and GDR250 2 years ago
github-wm.png add github screenshot 2 years ago
in-container [in-container] fix directories 2 years ago
init.sql use smaller number of rivers during development 2 years ago
layer2img.py more consistent figure names 2 years ago
mj-msc-full.pdf stamp 2 years ago
mj-msc.tex update links to listings 2 years ago
openmap-wm-bad.png test harness 2 years ago
openmap-wm-good.png test harness 2 years ago
osi-logo.pdf a few more figures 2 years ago
postgis-logo.png postgis and postgresql logos 2 years ago
postgresql-logo.pdf postgis and postgresql logos 2 years ago
rivers-10.sql update all rivers from the new data source 2 years ago
rivers-50.sql update all rivers from the new data source 2 years ago
rivers-250.sql update all rivers from the new data source 2 years ago
salvis.png add salvis.png and README 2 years ago
slides-2021-03-29.txt remove demo 2 years ago
slides-2021-06-02.pdf Add final MSc thesis presentation 2 years ago
slides-2021-06-02.tex language 2 years ago
test-rivers.sql update README and docs 2 years ago
test.sql fix remaining bugs. gone from debug mode. 2 years ago
vars.awk test harness 2 years ago
visuals.sql default intersect_patience is 50 2 years ago
vu.pdf add generated vu.pdf 2 years ago
wang125-2.png more pics 2 years ago
wang125.png add wang125 2 years ago
wm.sql default intersect_patience is 50 2 years ago

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.