I'm looking for a way to take the overlap area of multiple polygons and work with that result as a single entity, ideally all in the API.


There are no extensive Javascript computational geometry implementations: most geometry libraries rely on JTS or its C++ port GEOS, neither of which have yet been ported to native Javascript. Most people handle this by using a spatial database such as PostGIS to manipulate geometries server-side, and then pass back the results with GeoJSON or similar. OpenGeo has an example application which does unions of input geometries from a webmap that might be of help.

If you'd like to implement the algorithm yourself in Javascript, check this SO post which describes the general process, which involves finding and removing interior points from the joint geometries.


As far as I know, the Google Maps API doesnt do much geoprocessing, so you would have to code the union yourself or look into using a spatially enabled database to do the union. I have usually just been able to code any simple geoprocessing that I needed for a Google Maps web page, so I cant be more helpful than that. Its just a suggestion for the next place to look.


You could use JTS to do your geoprocessing and then use the GALGWT library to integrate with Google Maps with the added benefit its all Java code so you can use an ide like eclipse to help you avoid simple mistakes. Also as its Java it can be uploaded on AppEngine and deployed as an cloud application.


I know this might not be what your looking for, but in case someone else stumbles to this link and it helps them...

If you make use of the ESRI Google Extender API and you also happen to have ArcGIS Server, you can make use of the geometry service and geoprocessing services. Hopefully they will update this API soon, so that it can work alongside v10 which has an improved geometry service allowing you to do operations like unions.

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.