[gdal-dev] Selection using OGR

user gdal userofgdal at gmail.com
Wed Nov 11 20:27:08 PST 2015


Hello,

I have a shape file which consists of many polygons (say 56).
Programmatically I wish to select (say, one poly.) from them. I proceeded
something like this.

OGRLayer *clippingshp; unsigned int NumPolygons;

while((tempfeature=inlayer->GetNextFeature( ))!=NULL)
{
  clippingshp->CreateFeature(tempfeature);
clippingshp->SetFeature(tempfeature);


  NumPolygons=clippingshp->GetFeatureCount( ); /* After this NumPolygons
should be 1 */

  /* But NumPolygons = 56, that is the whole file is selected */
  .
  .
  .
}

Can anyone tell me please how to select a feature (polygon in this context)
and copy it into an OGRLayer.

With many thanks,

Yours sincerely,
  B. Ramesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20151112/3f33e474/attachment.html>


More information about the gdal-dev mailing list