[gdal-dev] deleting feature exceptions

=?gbk?B?d293?= 27949218 at qq.com
Fri Aug 15 03:34:48 EDT 2008


Hi, Frank,thank you for reply. 
   I have posted the ticket with little experience here:
   http://trac.osgeo.org/gdal/ticket/2531.
   Attachment of this mail is the example project. Thank you for more help.
 ------------------
  To the world you're little, but to a person you're the world.
                                             Chen Xuexia

  
  
 ------------------ Original ------------------
  From:  "Frank Warmerdam"<warmerdam at pobox.com>;
 Date:  Fri, Aug 15, 2008 10:06 AM
 To:  "wow"<27949218 at qq.com>; 
 Cc:  "gdal-dev"<gdal-dev at lists.osgeo.org>; 
 Subject:  Re: [gdal-dev] deleting feature exceptions

  
 Chen,

I'm surprised both approaches don't work smoothly.  I'd suggest you boil
down a minimum example of the problem, and file a bug ticket on it
including the input data.

Best regards,
FrankW

2008/8/14 wow <27949218 at qq.com>:
>
> Hi,
>    i try to delete features from a set of shape file, sometimes get error. I
> use this version of ogrshapelayer.cpp  :
> http://trac.osgeo.org/gdal/changeset/10969 . Delete feature in two ways
> would get different result:
> (1)  for(iFeat=0;iFeat<nFeat;iFeat++)
>    {
>         int cplE = pLayer->DeleteFeature(0);
>         if(cplE==CE_None)
>        {
>          OGRShapeLayer* pShpLayer = (OGRShapeLayer*)pLayer;
>          cplE = pShpLayer->Repack();
>          if(cplE!=CE_None)
>          {
>             printf("delete feature failed £¡\n");
>             return false;
>          }
>       }
>   }
>    int nFeatRest = pLayer->GetFeatureCount();
>
>     These codes could delete each feature with returned value CE_None, and
> at the end nFeatRest=0. But when ran to pShpLayer->Repack()  second, the
> error occurs: "Failure writing DBF record 0", it jumped untill all features
> were deleted.
>
> (2)  for(iFeat=nFeat-1;iFeat>=0;iFeat--)
>  {
>       int cplE = pLayer->DeleteFeature(iFeat);
>      if(cplE==CE_None)
>      {
>            OGRShapeLayer* pShpLayer = (OGRShapeLayer*)pLayer;
>            cplE = pShpLayer->Repack();
>            if(cplE!=CE_None)
>           {
>            printf("delete feature failed £¡\n");
>           return false;
>           }
>      }
>  }
>     int nFeatRest = pLayer->GetFeatureCount();
>
>     These codes could delete each feature with returned value CE_None, but
> at the end nFeatRest>0 and nFeatRest<nFeat, some features were NOT deleted
> yet!   Same as (1), when ran to pShpLayer->Repack()  second, the error
> occurs: "Failure writing DBF record iFeat", it jumped untill all features
> were deleted.
>     Trace the error  "Failure writing DBF record ..." into Repack():
>    /* --------------------------------------------------------------------
> */
>    /*      Build a list of records to be dropped.
> */
>    /* --------------------------------------------------------------------
> */
>     ...
>     for( iShape = 0; iShape < nTotalShapeCount; iShape++ )
>     {
>         if( DBFIsRecordDeleted( hDBF, iShape ) )//------------ERROR jumped
> ---------
>             panRecordsToDelete[nDeleteCount++] = iShape;
>     }
>     Why did this phenomena occurs?
>     Thank you.
>
> ------------------
> To the world you're little, but to a person you're the world.
>                                             Chen Xuexia
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent


ÒÔÏÂÎļþͨ¹ýQQÓÊÏäµÄÖÐתվ·¢¸øÄú¡£±£´æʱ¼äÓÐÏÞÖÆ£¬Ç뼰ʱÌáÈ¡¡£min-projV1.4.rar (2.92M) [ÏÂÔØ]  (ÓÐЧʱ¼äµ½: 2008Äê8ÔÂ22ÈÕ 15:14)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080815/8717d96e/attachment-0001.html


More information about the gdal-dev mailing list