Hacker News new | ask | show | jobs
by zylepe 1692 days ago
Flatmap calls into user-defined profiles in 2 places: first when processing each input element to map it to a vector tile feature, then a second time right before emitting all vector features in a layer.

That second call lets you manipulate vector features on each tile using JTS geometry utilities (i.e. merge nearby polygons or lines with the same tags). PostGIS uses GEOS which is ported from JTS so you have access to pretty much the same geometry utilities - often with the same name.

It's definitely not as flexible as a PostGIS based solution - especially if you join faraway features that don't appear on the same tile, but in practice it was enough to port the entire OpenMapTiles schema.

See the basemap layers package: https://github.com/onthegomap/flatmap/tree/main/flatmap-base... for example see the landcover layer https://github.com/onthegomap/flatmap/blob/main/flatmap-base... which was ported from the SQL contained in https://github.com/openmaptiles/openmaptiles/tree/master/lay...

Also, this OpenMapTiles PR might help improve your existing pipeline after it gets merged: https://github.com/openmaptiles/openmaptiles-tools/pull/383

Edit: formatting