Siva,<div><br></div><div>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.</div>
<div>To actually remove the features, you have to create a new shapefile layer object and save it.</div><div><br></div><div>BTW, you should use GetFeatureCountI() instead of GetFieldCount().</div><div><br><div class="gmail_quote">
On Wed, Oct 31, 2012 at 4:01 PM, SIVA RAMA KRISHNA <span dir="ltr"><<a href="mailto:s.r.kriishna@gmail.com" target="_blank">s.r.kriishna@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
hai chaitanya,<br><br> I have fixed it by using point.within(geometry)<br> But I am having a problem with deleting a feature <br> After deleting a feature succesfully from a shape file <br>
Next time when i load it is all features count but displying correctly with the undelaeted features <br><br>
<p style="margin-bottom:0in"> <font size="4">void
myWindow::selectingFeature(QMouseEvent* event)</font></p><div class="im"><br>
{<br> poLayer->ResetReading();<br>
while( (poFeature = poLayer->GetNextFeature()) != NULL
)<br>
{<br>
poGeometry = poFeature->GetGeometryRef();<br>
if(poGeometry !=NULL<br>
&& wkbFlatten(poGeometry->getGeometryType()) ==
wkbPolygon)<br>
{<br><br></div>
if( p2.Within(poGeometry))<br>
{<br>
polyShape = (OGRPolygon*)
poGeometry;<br>
qDebug()<<"Feature
Selected";<br>
qDebug()<<poFeature->GetFID();<br>
path.addPolygon(polygon);<br>
featureid=poFeature->GetFID();<br>
}<br>
<br><br>
}<br><br>
}<br><br> }<br><br><br><br>// this is a slot after deleting a feature<br>void
myWindow::DeletingFeature()<br>{<br><br>
qDebug()<<" deleting feature";<div class="im"><br>
poLayer->ResetReading();<br> while(
(poFeature = poLayer->GetNextFeature()) != NULL )<br>
{<br></div>
poLayer->DeleteFeature(featureid);<br>
qDebug()<<"deleted"<<poFeature->GetFieldCount();<br>
qDebug()<<poFeature->GetFID();<br>
}<br><br>}<br><br><font color="#b20808"><font face="Monospace"><font style="font-size:9pt">No
of features 3 </font></font></font>
<p></p>
<p style="margin-bottom:0in"><font color="#b20808"><font face="Monospace"><font style="font-size:9pt">Feature
Selected </font></font></font>
</p>
<p style="margin-bottom:0in"><font color="#b20808"><font face="Monospace"><font style="font-size:9pt">1
</font></font></font>
</p>
<p style="margin-bottom:0in"><font color="#b20808"><font face="Monospace"><font style="font-size:9pt">not
</font></font></font>
</p>
<p style="margin-bottom:0in"><font color="#b20808"><font face="Monospace"><font style="font-size:9pt">deleting
feature </font></font></font>
</p>
<p style="margin-bottom:0in"><font color="#b20808"><font face="Monospace"><font style="font-size:9pt">deleted
1 </font></font></font>
</p>
<p style="margin-bottom:0in"><font color="#b20808"><font face="Monospace"><font style="font-size:9pt">1
</font></font></font>
</p>
<p style="margin-bottom:0in"><font color="#b20808"><font face="Monospace"><font style="font-size:9pt">ERROR
1: Attempt to delete shape with feature id (1), but it is marked
deleted already.</font></font></font></p>
<p style="margin-bottom:0in"><font color="#b20808"><font face="Monospace"><font style="font-size:9pt">deleted
1 </font></font></font>
</p>
<p style="margin-bottom:0in"><font color="#b20808"><font face="Monospace"><font style="font-size:9pt">2
</font></font></font>
</p>
<p style="margin-bottom:0in">with Regards<br>
</p>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Best regards,<br>Chaitanya kumar CH.<br><br>+91-9494447584<br>17.2416N 80.1426E<br>
</div>