[gdal-dev] To know about centriod of a polygon shape file

Chaitanya kumar CH chaitanya.ch at gmail.com
Wed Feb 20 04:21:53 PST 2013


Siva,

If you want to remove features with duplicate centroids, it is not safe to
use the spatial filter directly. A centroid may lie outside the geometry.

Make a duplicate layer using OGRDataSource::CopyLayer() and replace the
geometry in each feature with its centroid. So, the duplicate layer will
have all the corresponding centroids. Now you can loop through each feature
in the original layer and then get coinciding points by applying a spatial
filter on the duplicate layer.

Let us know how it went.


On Wed, Feb 20, 2013 at 12:04 PM, SIVA RAMA KRISHNA
<s.r.kriishna at gmail.com>wrote:

>  Chaitanya,
>   Fine i got your point .I wanted to know when do different  features have
> same centroids for  removing duplicate centriods
>
>    With Regards
>



-- 
Best regards,
Chaitanya kumar CH.

+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130220/9887f8b9/attachment.html>


More information about the gdal-dev mailing list