[gdal-dev] [WFS Drvier] "Id Only" and "Geometry Only"
Paolo Corti
pcorti at gmail.com
Fri Mar 16 11:22:44 EDT 2012
On Fri, Mar 16, 2012 at 3:30 PM, xavier lhomme <lhomme.xavier at gmail.com> wrote:
> Hello
> I want to selectFeatures from a WFS DataSource.
> Is it possible to return Geometry Only without the attribut ?
> And Is it possible to return only Id (without Geometry and Attribut ) ?
>
If using ogrinfo, you can set the -geom and -fields parameters, as well
documented here [1], for example this will retrieve geometries, but
not other fields:
ogrinfo -ro WFS:"http://myserver/ows" mylayer -geom=YES -fields=NO
Or, append the PROPERTYNAME GetFeatureInfo's parameter in query
string, for example:
ogrinfo -ro WFS:"http://myserver/ows?PROPERTYNAME=field1,field2" mylayer
Programmatically, I do not see a way with the API to set this field
filters (but I may be wrong), but you could still define a virtual
layer, choosing the needed fields you want to select, and then
access the layer using the VRT driver.
For example:
<OGRVRTDataSource>
<OGRVRTLayer name="mylayer">
<SrcDataSource>WFS:http://myserver/ows</SrcDataSource>
<SrcLayer>mylayer</SrcLayer>
<Field name="field1" src="field1" />
<Field name="field1" src="field1" />
</OGRVRTLayer>
</OGRVRTDataSource>
best regards
P
[1] http://www.gdal.org/ogrinfo.html
--
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti
More information about the gdal-dev
mailing list