Skip to main content

MVT polygon and hole clipping

Shared MVT fill/fill-extrusion display views can clip polygons to tile rectangles. Interior holes survive; holes crossing an edge become notches. Disconnected pieces of concave polygons return MultiPolygon. Source queries retain original polygons,holes,buffers and stable IDs; display/rendered queries use clipped geometry.

map.addLayer({id:'land',type:'fill',source:'vector','source-layer':'land',
  paint:{'fill-color':'lime','fill-opacity':0.5,'fill-outline-color':'transparent'}});
await map.sqs.flush({render:true});
const original=await map.querySourceFeatures('vector',{sourceLayer:'land'});
const displayed=await map.queryRenderedFeatures(pixel,{layers:['land']});

Explicit transparent outlines are honored; shared style fills use their declared outlines. Solid,hole and seam pixels matched one original GeoJSON polygon in acceptance. Complete nontransparent stroke pixel boundaries and cross-tile ownership remain pending. Geometry clipping does not imply complete stroke/label compatibility.

Polygons entirely inside the rectangle reuse original geometry. A crossing polygon permits16384 input vertices; outputs retain the500,000-coordinate/64MiB shared tile budgets. Overflow fails explicitly and preserves old data. The pureRust i_overlay9.0.0 math library supplies i64 adaptation and OGC output,with no MapLibre/GDAL/UI dependency. Licenses and checksums accompany the matching SDK.

The complete HTML includes all four buttons,embedded MVT bytes,protocol/request transformation,raw/rendered queries,original GeoJSON reference/restoration,handlers,credits and disposal. It runs without the acceptance server. The portable script uses acceptance tiles generated by SqsMap.

See point/line clipping and MVT sources. Cross-tile stitching/merging,complete pixel clipping,devices and formal release remain pending.