[gdal-dev] GeoRSS and TestCapability("CreateField")

Even Rouault even.rouault at mines-paris.org
Wed Jan 8 13:04:37 PST 2014


Le mercredi 08 janvier 2014 21:23:50, Jared Erickson a écrit :
> Hi all,
> 
> I am working with the GeoTools developers on their OGR module in order to
> add OGR support for GeoScript and I have a question about what exactly
> Layer.TestCapability means.  In GeoTools (which is written in Java), when
> creating a new Layer we call Layer.TestCapability("CreateField") to see if
> we can create a new field.  For most drivers this works fine.  For GeoRSS
> and GPX testing for CreateField returns false even though if we comment out
> the TestCapability("CreateField") check creating the fields succeeds.  Here
> is the GeoTools code in question:
> 
> https://github.com/geotools/geotools/blob/master/modules/unsupported/ogr/og
> r-core/src/main/java/org/geotools/data/ogr/OGRDataStore.java#L188
> 
> Are we using TestCapability("CreateField") correctly?  

Jared,

Your code looks correct. You've just found a bug in the GeoRSS and GPX 
drivers. Thanks for the report. They indeed should declare the CreateField 
capabality. I've now fixed that in GDAL trunk (as well as the SOSI driver but 
that one is far less popular). In the meantime, I guess you could hardcode an 
exception for those 2 drivers.

> Should it be used
> when creating new layers or just when adding a field to an existing layer?

It is OK in both scenarios.

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list