Finding centroids from shapefiles (php/mapscript)

Tim Schaub tim at COMMENSPACE.ORG
Mon Jun 19 08:33:12 PDT 2006


> 
> Can I find or calculate the centroid of a shapefile (ideally 
> from php/ mapscript)?

If you really want to find the centroid of each shape, I think you'd
have to convert the shapeObj to well known text, parse through to get
points, and calculate the centroid yourself.

If the centroid of the shape's extent is sufficient, you can get the
shape->bounds and find the center point.

Tim

> 
> cheers
> 
> Ben
> 
> 
> -- 
> 
> Ben Madin
> 
> t/f: 08 9192 5535
> m: 0448 887 220
> ben at remoteinformation.com.au
> 



More information about the MapServer-users mailing list