I am trying to serve GeoJSON FeatureCollection tiles with each feature's geometries trimmed to the tile boundary.

I am working on a Leaflet plugin to re-assemble the geometries. It works by building up a pool of lines for a unique feature, removing any equal lines in opposing directions, then walking any unwalked lines to recreate the linear rings.

This currently works, except I am having trouble dealing with polygon holes. When I have a polygon with a hole and generate the GeoJSON to intersect it with the tile boundary - I lose the hole information.

Does anyone have any ideas on how I could keep the hole information intact on the server side, or alternatively detect this happening on the client-side?

  • Why don't you take the xmin, ymin, xmax and ymax for each feature and convert it directly to a bounding box polygon? – user14902 Feb 5 '13 at 19:59
  • you mean ST_Envelope(geom) – Mike T Aug 5 '13 at 4:58

I am using something like this:

ST_SimplifyPreserveTopology((ST_Dump(ST_Intersection(way, !bbox!))).geom, !pixel_width! / 2) AS way


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.