I need to merge three overlapping GeoJSON GeometryCollections of Polygon. Ultimately, the end result needs to be a geom type for PostGIS (e.g. MULTIPOLYGON) so I can easily check if particular points fall within it (e.g. with ST_Intersects).

The GeoJSON files come from OpenTripPlanner, and they represent isochrones. The reason that there are multiple, overlapping files is that we use the same starting point but more than one starting time. So actually they are very similar but not exactly.

We tried mapshaper for merging but it does not really "union" the polygons, instead it puts them all in one geometry so effectively that just puts them all on top of each other.

We were able to convert each file individually into multipolygon using ST_CollectionHomogenize however still missing what function or tool we can use to merge these into a single multipolygon. Note that preservation of outer rings is a requirement, which seemed to rule out any standard PostGIS function we tried.

  • Not following you. If preservation of outter rings where the outter rings overlap is a requirement, then you can't create a valid multipolygon from that. ST_Union would normally be the function you would use, but then it may destroy some of your overlapping outter rings. – LR1234567 Jul 13 '14 at 20:15
  • Sorry @LR1234567, I'm not a GIS professional so may have used the wrong terms. It might be clearer if I use layman terms rather than incorrect proper terms. What I mean is that I want to preserve any "islands". I don't mind overlapping and merging islands, but I don't want the algorithm to absorb the islands and create a single polygon like ST_Buffer might do. – rgareth4 Jul 14 '14 at 7:41

Your Answer

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

Browse other questions tagged or ask your own question.