[Geoserver-users] restrict geometry in WFS GetFeature response

Hi All,

I want to restrict geometry GML in WFS GetFeature responses, so it
should be able to serve only attributes. I've tried to achieve it
using schema mapping described here:
http://docs.geoserver.org/stable/en/user/services/wfs/schemamapping.html

I choosed the built-in layer topp:states and created a file
workspaces/topp/states_shapefile/states/schema.xsd

with contents
<xsd:schema elementFormDefault="qualified"
targetNamespace="http://www.openplans.org/topp&quot;&gt;
<xsd:import namespace="http://www.opengis.net/gml&quot;
schemaLocation="http://att-it.homelinux.net:23880/geoserver/schemas/gml/2.1.2/feature.xsd&quot;/&gt;
<xsd:complexType name="statesType">
<xsd:complexContent>
<xsd:extension base="gml:AbstractFeatureType">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="0" name="STATE_NAME"
nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="STATE_FIPS"
nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="SUB_REGION"
nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="STATE_ABBR"
nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="LAND_KM"
nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="WATER_KM"
nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="PERSONS"
nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="FAMILIES"
nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="HOUSHOLD"
nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="WORKERS"
nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="DRVALONE"
nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="CARPOOL"
nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="PUBTRANS"
nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="EMPLOYED"
nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="UNEMPLOY"
nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="SERVICE"
nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="MANUAL" nillable="true"
type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="SAMP_POP"
nillable="true" type="xsd:double"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="states" substitutionGroup="gml:_Feature"
type="topp:statesType"/>
</xsd:schema>

but nothing changes as I try the demo request.

thank you in advance.
best regards: Balázs Bámer

On Mon, Jan 31, 2011 at 6:07 AM, Balázs Bámer <bamerbalazs@anonymised.com> wrote:

Hi All,

I want to restrict geometry GML in WFS GetFeature responses, so it
should be able to serve only attributes. I've tried to achieve it
using schema mapping described here:
WFS schema mapping — GeoServer 2.25.x User Manual

I choosed the built-in layer topp:states and created a file
workspaces/topp/states_shapefile/states/schema.xsd

Just include the properties you need in the request, for example this
request will only return name, area and the geometry.

<wfs:GetFeature service="WFS" version="1.1.0"
  xmlns:topp="http://www.openplans.org/topp&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;
  xmlns:ogc="http://www.opengis.net/ogc&quot;
  xmlns:gml="http://www.opengis.net/gml&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://www.opengis.net/wfs
                      http://schemas.opengis.net/wfs/1.1.0/wfs.xsd&quot;&gt;
  <wfs:Query typeName="topp:states">
  <wfs:PropertyName>topp:STATE_NAME</wfs:PropertyName>
  <wfs:PropertyName>topp:LAND_KM</wfs:PropertyName>
  <wfs:PropertyName>topp:the_geom</wfs:PropertyName>
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>topp:LAND_KM</ogc:PropertyName>
<ogc:LowerBoundary><ogc:Literal>100000</ogc:Literal></ogc:LowerBoundary>
<ogc:UpperBoundary><ogc:Literal>150000</ogc:Literal></ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

Ian
--
Ian Turton