[gdal-dev] to detect a point in ageometry

Chaitanya kumar CH chaitanya.ch at gmail.com
Wed Oct 31 04:46:49 PDT 2012


Siva,

In shapefile format, deleted features are just 'marked' as deleted instead
of actually removing them. This makes it faster. However, the statistics
may not be updated. Specifying the the bForce parameter with the
GetFeatureCount() method may be useful.
To actually remove the features, you have to create a new shapefile layer
object and save it.

BTW, you should use GetFeatureCountI() instead of GetFieldCount().

On Wed, Oct 31, 2012 at 4:01 PM, SIVA RAMA KRISHNA
<s.r.kriishna at gmail.com>wrote:

> hai chaitanya,
>
>                         I have fixed it by using point.within(geometry)
>                         But I am having a problem  with  deleting a
> feature
>                         After deleting a feature succesfully from a shape
> file
>                         Next time when i load it is all features  count
> but displying correctly with the undelaeted features
>
>   void myWindow::selectingFeature(QMouseEvent* event)
>
>   {
>     poLayer->ResetReading();
>    while( (poFeature = poLayer->GetNextFeature()) != NULL )
>            {
>                 poGeometry = poFeature->GetGeometryRef();
>                  if(poGeometry !=NULL
>                                       &&
> wkbFlatten(poGeometry->getGeometryType()) == wkbPolygon)
>                                 {
>
>                                     if( p2.Within(poGeometry))
>                                     {
>                                            polyShape  = (OGRPolygon*)
> poGeometry;
>                                            qDebug()<<"Feature Selected";
>                                            qDebug()<<poFeature->GetFID();
>                                            path.addPolygon(polygon);
>                                            featureid=poFeature->GetFID();
>                                      }
>
>
>                                }
>
>                    }
>
>         }
>
>
>
> // this is a slot after deleting  a feature
> void myWindow::DeletingFeature()
> {
>
>      qDebug()<<" deleting feature";
>
>      poLayer->ResetReading();
>      while( (poFeature = poLayer->GetNextFeature()) != NULL )
>              {
>                   poLayer->DeleteFeature(featureid);
>                   qDebug()<<"deleted"<<poFeature->GetFieldCount();
>                   qDebug()<<poFeature->GetFID();
>               }
>
> }
>
> No of features 3
>
> Feature Selected
>
> 1
>
> not
>
> deleting feature
>
> deleted 1
>
> 1
>
> ERROR 1: Attempt to delete shape with feature id (1), but it is marked
> deleted already.
>
> deleted 1
>
> 2
>
> 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/20121031/0d0ee607/attachment.html>


More information about the gdal-dev mailing list