stud/IV
2021-05-16 16:16:44 +03:00
..
aggregate-rivers.sql also import GDR50 and GDR250 2021-05-16 14:52:01 +03:00
amalgamate1.png amalgamation 2021-04-29 18:08:21 +03:00
bib.bib acknowledgments 2021-05-15 14:16:58 +03:00
db support in-container make 2021-05-09 16:58:17 +03:00
Dockerfile clean up files 2021-05-09 19:39:53 +03:00
extract-and-generate gentler remove 2021-04-25 11:54:39 +03:00
gdr2pgsql also import GDR50 and GDR250 2021-05-16 14:52:01 +03:00
in-container pre-warm matplotlib font cache 2021-05-09 19:28:35 +03:00
init.sql use smaller number of rivers during development 2021-05-06 11:14:30 +03:00
layer2img.py documentation 2021-05-16 11:58:23 +03:00
Makefile color consistency 2021-05-16 16:16:44 +03:00
mj-msc.tex color consistency 2021-05-16 16:16:44 +03:00
notes.txt self-crossing bugfix 2021-04-15 14:12:18 +03:00
openmap-wm-bad.png test harness 2021-05-15 00:31:41 +03:00
openmap-wm-good.png test harness 2021-05-15 00:31:41 +03:00
README.md update all rivers from the new data source 2021-05-16 14:57:58 +03:00
rivers-10.sql update all rivers from the new data source 2021-05-16 14:57:58 +03:00
rivers-50.sql update all rivers from the new data source 2021-05-16 14:57:58 +03:00
rivers-250.sql update all rivers from the new data source 2021-05-16 14:57:58 +03:00
slides-2021-03-29.txt remove demo 2021-03-29 15:05:21 +03:00
test-rivers.sql explain where the bug is (from). 2021-05-11 20:38:34 +03:00
test.sql fix remaining bugs. gone from debug mode. 2021-05-13 22:50:30 +03:00
vars.awk test harness 2021-05-15 00:31:41 +03:00
visuals.sql displaying gdr50 and gdr250 wip 2021-05-16 16:10:39 +03:00
vu.pdf add generated vu.pdf 2021-04-29 19:02:54 +03:00
wang125.png add wang125 2021-05-07 15:15:17 +03:00
wm.sql test harness 2021-05-15 00:31:41 +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.

Structure

There will be 2 deliverables from this folder:

  • wm.sql, the implementation.
  • paper mj-msc-full.pdf, a MSc thesis, explaining it.

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
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. Left as an exercise for the reader.

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, postgresql client, geopandas, pygments, osm2pgsql, poppler, and a "quite extensive" LaTeX installation. This was tested on Debian 11.

Contributing

Please reach out to me before contributing. As of writing, this is not ready to accept broader contributions, TODO:

  • Elimination operator.
  • Exaggeration operator.
  • Combination operator.
  • CI (unlikely to happen).
  • Known bug in wm_self_crossing: the program crashes with a river in Lithuania.

License

GPL 2.0 or later, same as PostGIS.