[Gdal-dev] Shapefile feature deletion and feature count

Frank Warmerdam warmerdam at pobox.com
Sat Mar 10 13:59:36 EST 2007

Andrea Aime wrote:
> So far it seems I'll have to write a generic base infrastructure, and
> then provide variant behavior with helper classes/subclasses to handle
> the difference between various drivers. For example, Geotools
> API requires me either not writing at all, or support all writing
> features. To cope with this, I'll have to create classes that allow
> me to move and rename layers for each different format I want to 
> support, since most of the OGR data sources I'm interested with
> do not support delete/update (Geotools is lacking on file based
> data sources). That is, the idea is that if I want to mimic in place
> update/delete, I'll really have to rewrite the file with a different
> name/location, delete the original one, and finally move/rename the
> new one.


Perhaps the GeoTools API should try being more fine grained with regard
to writing features.  Assuming that is impractical, I would suggest a
generic approach to read access, and then using some "working" format
for all update access, and on close copying back to the original format.
This approach would minimize the amount of driver specific work.

Overall, as long as geotools takes such a strict view of datastore
responsibilities for writing, you are pretty much stuck implementing
update in place via a working format.  For the time being you could
likely use MEM format as the working format though of course this
makes working with large datasets impractical.

Shapefile is not a good working format since it imposes so many
extra restrictions (short field names, no mixing geometry types,
no variable length fields).

Ultimately the question arises about how important it is to provide
write access through OGR for GeoTools.

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    | President OSGeo, http://osgeo.org

More information about the Gdal-dev mailing list