[mapserver-users] Getting centroid coords

Thomasch thomaschx at gmx.de
Tue Feb 5 12:46:58 PST 2013


Bistrais, Bob wrote:

> $centroid = $oShape->getCentroid();
from http://mapserver.org/mapscript/php/index.html#shapeobj :
"pointObj getCentroid()
     Returns a point object representing the centroid of the shape. Only 
available if php/mapscript is built with GEOS library."

Here you get an point object
>
> print "Centroid=". $centroid(x).",". $centroid(y);

try print "Centroid=".$centroid->x;

Thomasch


More information about the mapserver-users mailing list