[Gdal-dev] Center of polygon

Daniel Morissette dmorissette at dmsolutions.ca
Mon Apr 5 18:24:35 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?
> 
> 

The MITAB driver contains a function called OGRPolygonLabelPoint() in 
ogr/ogrsf_fmrts/mitab/mitab_geometry.cpp that will compute a label point 
  on an OGRPolygon.

The function is only local to the MITAB driver and is not part of the 
public OGR API, but you can probably make a copy.

Daniel
-- 
------------------------------------------------------------
  Daniel Morissette               dmorissette at dmsolutions.ca
  DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------




More information about the Gdal-dev mailing list