Selon Benjamin <[email protected]>: > Hi, > > Is an OGR::Geometry method which compute an interior point exist ?
To my knowledge there is no such method. If you don't have particular constraints on the point except that it must be at the interior of the polygon, you could take a random vertex of the boundary, compute the distance D to the next point, and then compute various points located on a circle centered on that vertex and of radius D/2 until the IsPointOnSurface() returns TRUE. Not very efficient, there are likely better methods... > I have just found a Centroid() method but "The centroid is not necessarily > within the geometry". > > So the centroid of: > POLYGON ((0 0,0 5, 5 5, 5 4, 1 4, 1 1, 5 1, 5 0, 0 0)) is near to (2 2.5), > it's within the polygon. > _____ > | ___| > | |___ > |_____| > > (ASCII fan-art o/) > > For example, with JTS (Java Topologie Suite) we can obtain an interior point > (0.5 2.5). Do you know the name of the JTS method ? It might also exist in GEOS, the C++ port of JTS that GDAL relies on to do geometry related computations. _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
