geoPHP icon indicating copy to clipboard operation
geoPHP copied to clipboard

union() not working even for example

Open ckotwn opened this issue 11 years ago • 3 comments

Trying to use the union() to combine two polygons. First by following the example:

$poly1 = geoPHP::load('POLYGON((30 10,10 20,20 40,40 40,30 10))','wkt');
$poly2 = geoPHP::load('POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30, 35 35, 30 20, 20 30))','wkt');
$combined_poly = $poly1->union($poly2);

Then the $combined_poly is null after the last line is executed. Please note I take the dollar sign away from geoPHP::load() because the it complained "Class name must be a valid object or a string".

ckotwn avatar Nov 11 '13 10:11 ckotwn

@burkeker, do you have GEOS extensions installed in your environment? The union() method isn't implemented unless you have that library installed.

https://github.com/phayes/geoPHP/wiki/API-Reference#wiki-Methods-2

fillerwriter avatar Nov 11 '13 15:11 fillerwriter

It would be great that when the extension is not properly installed the library would throw an exception, otherwise it just fails silently

marcorivm avatar Apr 07 '15 05:04 marcorivm

It would be even better if it didn't depend on a library that was impossible to build even now.

alanondra avatar Oct 29 '19 18:10 alanondra