[Gdal-dev] Re: Delete feature?

Frank Warmerdam warmerdam at pobox.com
Thu Oct 9 11:14:16 EDT 2003


Lorenzo Sassolini wrote:
> Frank,
> 
> using the OGR library I see that there are many methods to access 
> DBMS-based datasources (Oracle) in a client-server way.
> 
>  But it seems to me that the only way to delete a feature from a 
> datasource is to save the whole layer in the datasource without that 
> feature. Is it true?
> 
> I see that for a file-based datasource this is correct, but for a 
> DBMS-based datasource it would be possible to delete a single feature.
> 
> Does exists a “workaround” to solve this problem?
> 

Lorenzo,

I agree that the OGR API should include a delete feature virtual method, and
it should be implemented for any datasource that it makes sense for.  I am
checking support for this into CVS, and will for the time being just implement
it for the "Mem" format (in memory layers).  What drivers were you needing it
for?

As a workaround for DBMS based drivers you can use ExecuteSQL() to delete
a feature if you have a way of uniquely selecting the feature.  Note for some
kinds of DBMS sources the FID is assigned linearly while scanning and isn't
actually a field in the table.  In these cases deleting by FID can be
problematic.

Best regards,

-- 
---------------------------------------+--------------------------------------
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





More information about the Gdal-dev mailing list