OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.9k stars 2.55k forks source link

Feature Request: Support automatically and efficiently re-combining vector tiles #7979

Open jerstlouis opened 1 year ago

jerstlouis commented 1 year ago

Feature request

Support automatically and efficiently recombining vector tiles as features in OGR/GDAL.

As initially brought up in #7934

image

When marking artificial segments, an efficient "union" algorithm can be implemented. For MVTs, this can be done by clipping the geometry spilling in the borders to a 2DTMS tile's axis-aligned bounding box (AABB) again, with the clipping algorithm marking artificial segments at the edges (e.g., as 'hidden' flag for From and To of vertices of (Multi)Polygon contours, or a vertex of a cut (Multi)LineString). Then an efficient algorithm can recombine geometry for shared tile boundary edges based on those few points along the edge, for which a correspondance can easily be established from both sides of the tile boundary.

This would apply to the OGC API, MVT, MBTiles and PMTiles driver, and is a much more useful resolution than the proposed:

add a warning in the documentation page, similary to the one of the MVT, MBTiles and PMTiles driver: "The driver will make no effort of stitching together geometries for linear or polygonal features that overlap several tiles. An application that wishes to eliminate those interrupts could potentially use the CLIP=NO open option to get larger boundaries, and use appropriate clipping graphic primitives to hide those discontinuities." And expose this CLIP=NO open option in the OGCAPI driver

rouault commented 1 year ago

with the clipping algorithm marking artificial segments at the edges (e.g., as 'hidden' flag for From and To of vertices of (Multi)Polygon contours, or a vertex of a cut (Multi)LineString)

I don't understand what this means: is it something the writer should do ? If so, are there examples of such tiles ?

jerstlouis commented 1 year ago

@rouault Re-clipping and marking artificial segments is something that the "reader" of MVTs which contain an extra border would do to facilitate re-assembling them as features. Some formats of tiled vector data may be encoded in a way where this is already part of the data model (e.g., MIL-STD-2407 Vector Product Format or our GNOSIS Map Tiles). Without either of these (extra border or artificial segments markers) options, a reader would need to look at adjacent tiles and look for touching features with identical IDs to identify artificial segments.

Our server also generates GeoJSON with a "line::hidden" property that follows this idea:

https://maps.gnosis.earth/ogcapi/collections/Daraa:AgricultureSrf/tiles/WebMercatorQuad/14/6620/9840.geojson

See OGC Testbed 13 - Vector Tiles ER and OGC Change Request 515 for some additional details on the idea.