Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

Here is a screenshot of two adjacent tiles, to demonstrate: http://cl.ly/image/0c2j260s2N2E

I hope this is clear!

Thanks

share|improve this question

2 Answers 2

I am using something like this:

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

...

share|improve this answer

Why don't you take the xmin, ymin, xmax and ymax for each feature and convert it directly to a bounding box polygon?

share|improve this answer
    
you mean ST_Envelope(geom) –  Mike T Aug 5 '13 at 4:58

Your Answer

 
discard

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.