[Gdal-dev] Center of polygon

Frank Warmerdam warmerdam at pobox.com
Mon Apr 5 15:35:17 EDT 2004


Clay, Bruce wrote:
> Is there a method within OGR to find the center of a polygon (where it
> is not part of the data set) or polyline for the purposes of centering a
> label?  If not does anyone have a method they are willing to share to
> walk through the data of a polygon / ring to determine the center?

Bruce,

There is no support this currently in GDAL/OGR.  You might find something
like this in the general GEOS geometry engine.  There is also some centroid
code in Shapelibs contrib directory if you would like to adapt that.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list