[gdal-dev] Proposed addition of OGR_L_GetName() /
OGRLayer::GetName()
Frank Warmerdam
warmerdam at pobox.com
Sat Aug 14 13:57:52 EDT 2010
On Sat, Aug 14, 2010 at 11:18 AM, Even Rouault
<even.rouault at mines-paris.org> wrote:
> Hi gdal-devs,
>
> Here's a proposal for adding OGR_L_GetName() / OGRLayer::GetName().
>
> The proposed patch in http://trac.osgeo.org/gdal/ticket/3719 introduces a new
> virtual method GetName?() at the OGRLayer level.
>
> The semantics of this method is to return the same result as GetLayerDefn()-
>>GetName(). This is indeed the default implementation of the OGRLayer class
> itself.
>
> So, what is it usefull for ? A few drivers, like PG since
> http://trac.osgeo.org/gdal/changeset/20277 , can benefit from GetName() by
> overloading it, without needing to fetch the layer definition, which is an
> operation that cost a few SQL requests per layer.
>
> So the new method can be usefull to present the list of layer names of a PG
> database.
>
> This would also be very handy for a OGR WFS driver I'm writing. It would save
> a DescribeFeatureType request for each layer. Just the GetCapabilities request
> would be needed.
>
> Apart from the PG driver, there's only another driver (LIBKML) in trunk that
> overrides GetName(), and its semantics matches the one explained above. So
> there's no backward compatibility issue.
>
> IMHO, this change seems to be a bit light to deserve a whole RFC, but I wanted
> to hear from your feedback before applying it.
Even,
I'm generally ok with this change. I would like to see it made explicit that
the name returned by OGRLayer::GetName() must always match the name
returned by the OGRFeatureDefn::GetName().
I am also wondering if there are any other aspects that should be handled
this way. Many applications want to show a list of laye names, and the
geometry type of the layer (ie. ogrinfo, QGIS, etc). Should we also be
making the geometry type a virtual method fetch on the layer?
I can see the change you propose being of benefit to essentially all the
RDBMS drivers.
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