Sign inSign up

pdok/sieve

By pdok

Updated about 1 year ago

Image
0

50K+

pdok/sieve repository overview

Sieve

GitHub license GitHub
release Go Report
Card Docker
Pulls

Sieves GeoPackage Polygon geometries.

The purpose of this application is to prerefine the (MULTI)POLYGON geometries in a geopackage used for vector tiles by filtering out geometries (based on the given resolution) smaller than the pixels that are generated from the given vectoriles. By doing this specific artifacts/errors regarding the rendering of vector tiles can be omitted, and less data needs to be processed.

Notes

  • It will take a Geopackage and writes a new Geopackage where all the (MULTI)POLYGON tables are sieved.
    • All other spatial tables are 'untouched' and copied as-is.
    • Other not spatial tables are not copied to the new geopackage.
  • The area of a POLYGON is used for determining if the geometries will be sieved, not the extent. So geometries with a extent larger then the given resolution but with an area smaller then that resolution will be sieved.
  • A MULTIPOLYGON will be split into separate POLYGONs that will be sieved. So a MULTIPOLYGON containing elements smaller then the given resolution will have those parts removed.
  • :warning: Spatialite lib is mandatory for running this application. This lib is needed for creating the RTree triggers on the spatial tables for updating/maintaining the RTree.
  • It is also possible to replace the filtered out geometry with a centroid POINT geometry instead, using the -replace option

Usage

go build .

go run . -s=[source GPKG] -t=[target GPKG] -r=[resolution for filtering] \
   -p=[pagesize for writing to target GPKG] -replace [t/f for replacing \
   instead of removing (optional)]

go test ./... -covermode=atomic

Docker

docker build -t pdok/sieve .
docker run --rm --name sieve -v `pwd`/example:/example pdok/sieve ./sieve \
   -s=./example/example.gpkg -t=./example/example-processed.gpkg -r=50001 -p=10

With the docker example above processing the example.gpkg would result in the following.

with interiors without
interiors

Inspiration

Code is inspired by the PostGis Sieve function from Mapbox.

Tag summary

Content type

Image

Digest

sha256:38ffa5627

Size

372.6 MB

Last updated

about 1 year ago

docker pull pdok/sieve