I'm not really asking for a chunk of code to do this, but more of an algorithm I can work with myself.

For example, this is the state of Maine, obviously, and I have the points of each county stored as an individual polygon. I am looking to process all of those points in whatever way possible to end up with only the outer outline. Does having islands outside of the outline complicate things? Note: I know this is easy in QGIS but I need to be able to do it on the fly with a PHP script. Note2: Maine is just an example, I know state outlines are available elsewhere...I could have any number of counties from potentially more than one state. Any help is greatly appreciated! - Brandon

EDIT: This question differs from others in that it is absolutely necessary for it to be done in PHP code, and not in GIS editing programs. In addition, this problem is more complicated than simply generating a convex hull as concave contours are a definite possibility. I honestly have no idea where to even begin and am looking for someone with a little more experience with problems like this than I have.

  • I note the edit, but the original answer shows how to do it with GeoTools (using Java), which does match your original question. – BradHards Nov 29 '13 at 6:49
  • I meant java in terms of basic java with no add-ons like GeoTools...basic math operations that could be translated into PHP. I guess I'll have to edit and flag or ask another question. – Brandon Schmidt Dec 1 '13 at 4:30
  • Re-opened as per edit, it's the math theory and algorithms that are wanted here, not a ready made tool. (I question the wisdom of a project that aims to do geometry munging in pure php, but that's a different topic. If really you must use a web only environment, there is much better support for javascript; see leaflet, topojson, d3) – matt wilkie Dec 1 '13 at 8:37

You may use GeoTools, which is an open source java toolkit, for doing your union/dissolve process, check out this Q/A:

combine several polygon objects in one polygon object with geotools (is it possible)?

|improve this answer|||||

This is a pure PHP polygon class that offers many geometric operations such as union and intersect. The library is released under GNU license. http://www.phpclasses.org/package/2544-PHP-Perform-geometric-operations-on-polygons.html

|improve this answer|||||
  • When I download and try to use it, I get tons of "Deprecated" errors. When I replace "=& new" with "= new" to fix this, I start getting 'Call to a member function isIntersect() on a non-object' errors. Any ideas? Thanks...hope this resource works. – Brandon Schmidt Jan 7 '14 at 2:34

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.