<div dir="ltr">It looks like <span style="color:rgb(0,0,0);font-size:12.8px">DOWNLOAD_SCHEMA=NO would do the trick, but if I use this in a VRT file this way it crashes GDAL.</span><div><span style="color:rgb(0,0,0);font-size:12.8px"><br></span></div><div><div><font color="#000000"><span style="font-size:12.8px"><OGRVRTDataSource></span></font></div><div><font color="#000000"><span style="font-size:12.8px"> <OGRVRTLayer name="OKCounties"></span></font></div><div><font color="#000000"><span style="font-size:12.8px"> <SrcDataSource><a href="http://cstest.coordinatesolutions.com/geoserver/wfs?VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=ogi:okcounties&SRSNAME=EPSG:900913">http://cstest.coordinatesolutions.com/geoserver/wfs?VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=ogi:okcounties&SRSNAME=EPSG:900913</a></SrcDataSource></span></font></div><div><font color="#000000"><span style="font-size:12.8px"> <OpenOptions></span></font></div><div><font color="#000000"><span style="font-size:12.8px"> <OOI key="DOWNLOAD_SCHEMA">NO</OOI></span></font></div><div><font color="#000000"><span style="font-size:12.8px"> </OpenOptions></span></font></div><div><font color="#000000"><span style="font-size:12.8px"> <LayerSRS>EPSG:900913</LayerSRS></span></font></div><div><font color="#000000"><span style="font-size:12.8px"> <SrcSQL>SELECT *, 'BRUSH(fc:#00000000);PEN(c:#008000,w:3px);LABEL(f:"Arial",c:#008000,s:14px,t:{name})' as OGR_STYLE from "okcounties"</SrcSQL> </span></font></div><div><font color="#000000"><span style="font-size:12.8px"> </OGRVRTLayer></span></font></div><div><font color="#000000"><span style="font-size:12.8px"></OGRVRTDataSource></span></font></div></div><div><font color="#000000"><span style="font-size:12.8px"><br></span></font></div><div><font color="#000000"><span style="font-size:12.8px"><br></span></font></div><div><span style="color:rgb(0,0,0);font-size:12.8px"><br></span></div><div><span style="color:rgb(0,0,0);font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-10-19 23:18 GMT+02:00 Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On jeudi 19 octobre 2017 22:55:50 CEST Tamas Szekeres wrote:<br>
> Hi all,<br>
><br>
> It looks like whenever we have a dataset (shapefile,db table,etc...) which<br>
> has a<br>
> column with such names like "description", "name", "location" GeoServer<br>
> maps it to the elements in the gml namespace (in a 1.1 request),<br>
> therefore DescribeFeatureType doesn't contain these attributes.<br>
><br>
> For example this response doesn't include the name attribute<br>
><br>
> <a href="http://cstest.coordinatesolutions.com/geoserver/wfs?VERSION=1.1.0&SERVICE=WF" rel="noreferrer" target="_blank">http://cstest.<wbr>coordinatesolutions.com/<wbr>geoserver/wfs?VERSION=1.1.0&<wbr>SERVICE=WF</a><br>
> S&REQUEST=DescribeFeatureType&<wbr>TYPENAME=ogi:okcounties<br>
><br>
> However that attribute is returned in the GetFeature request in the<br>
> gml:name section, like:<br>
><br>
> <a href="http://cstest.coordinatesolutions.com/geoserver/wfs?VERSION=1.1.0&REQUEST=Ge" rel="noreferrer" target="_blank">http://cstest.<wbr>coordinatesolutions.com/<wbr>geoserver/wfs?VERSION=1.1.0&<wbr>REQUEST=Ge</a><br>
> tFeature&TYPENAME=ogi:<wbr>okcounties<br>
><br>
> But as the result of this behaviour the WFS driver doesn't include this<br>
> item in the layer definition. Is that possible to retrieve these attributes<br>
> from the WFS driver as OGR fields for example to use them in SQL<br>
> expressions?<br>
<br>
</span>Hi Tamas,<br>
<br>
If your need is to filter on the server, then you'll need to compose the full<br>
URL at hand.<br>
If you want to post-filter, you can downloader the GetFeature request and open<br>
the GML file with the DOWNLOAD_SCHEMA=NO open option (or<br>
GML_DOWNLOAD_WFS_SCHEMA=NO configuration option)<br>
This will prevent the GML driver from trying to use the schema, and then it<br>
will discover the gml:name element.<br>
<br>
OGRFeature(okcounties):155<br>
gml_id (String) = okcounties.155<br>
name (String) = BEAVER<br>
state (Integer) = 40<br>
county (Integer) = 7<br>
stateplane (String) = N<br>
MULTIPOLYGON (((-100.945566 ....)))<br>
<br>
The XSD parser used by the WFS and GML drivers could also possibly be modified<br>
to hard-code the definition of those few GML fields (although they might<br>
depend on the GML version).<br>
<br>
<br>
Otherwise you can also use the GMLAS driver, but the result will be a bit<br>
inconvenient to use as it will create a dedicated layer for the name attribute<br>
(as gml:name can be repeated):<br>
<br>
$ ogrinfo GMLAS:out.xml<br>
INFO: Open of `GMLAS:out.xml'<br>
using driver `GMLAS' successful.<br>
1: okcounties (Multi Surface)<br>
2: okcounties_metadataproperty (None)<br>
3: okcounties_name (None)<br>
4: location (None)<br>
<br>
OGRFeature(okcounties):1<br>
ogr_pkid (String) = 213FC01A8AA5FA1E1ADC65B21904DA<wbr>34_okcounties_1<br>
id (String) = okcounties.155<br>
state (Integer64) = 40<br>
county (Integer64) = 7<br>
stateplane (String) = N<br>
MULTIPOLYGON (((-100.945566....)))<br>
<br>
OGRFeature(okcounties_name):1<br>
ogr_pkid (String) = 213FC01A8AA5FA1E1ADC65B21904DA<wbr>34_okcounties_1_name_1<br>
parent_ogr_pkid (String) = 213FC01A8AA5FA1E1ADC65B21904DA<wbr>34_okcounties_1<br>
value (String) = BEAVER<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
Even<br>
<br>
<br>
--<br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
</font></span></blockquote></div><br></div>