Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Why don't you take the xmin, ymin, xmax and ymax for each feature and convert it directly to a bounding box polygon? – Morten Blemmer 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


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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