I am having some issues in executing a WFS GetFeature request that I’m hoping someone can shed some light on.
I would like to make a WFS request (GET) to GeoServer, specify a data column and have ONLY the values in that column returned (as JSON). Using the STATES dataset example, I would like to make a request, supplying STATE_NAME, and have it return just the names of the 50 states (dropping all the other fields).
Is this a possibility?
I’ve been playing with the following request as a starting point with no luck in isolating just the STATE_NAME field:
http://localhost:8080/geoserver/wfs?request=getfeature&service=wfs&version=1.0.0&typename=topp:states&filter=STATE_NAME</Filter>&outputformat=json
My reason for doing this is that I have a very large dataset and I am unable to load the entire getfeature response as an object and split it from there.
Any help would be greatly appreciated.
Thank you.
Grant McKenzie
You need to use 'propertyname' parameter. From wfs 1.1 spec:
PROPERTYNAME
A list of properties may be specified for
each feature type that is being queried.
Refer to subclause 14.2.2 on how to form
lists of parameters. A "*" character can be
used to indicate that all properties should
be retrieved. There is a 1:1 mapping
between each element in a FEATUREID or
TYPENAME list and the
PROPERTYNAME list. The absense of a
value also indicates that all properties
should be fetched.
In KVP And there's more about it on page 37 for the xml.
Filter is to limit the results, propertyname is to say which attributes you'd like to receive in the results. Note that elements that are required in the XML have to be returned by GeoServer, as it would not be valid xml otherwise.
Grant.McKenzie@anonymised.com wrote:
I am having some issues in executing a WFS GetFeature request that I'm hoping someone can shed some light on.
I would like to make a WFS request (GET) to GeoServer, specify a data column and have ONLY the values in that column returned (as JSON). Using the STATES dataset example, I would like to make a request, supplying STATE_NAME, and have it return just the names of the 50 states (dropping all the other fields).
Is this a possibility?
I've been playing with the following request as a starting point with no luck in isolating just the STATE_NAME field:
<http://localhost:8080/geoserver/wfs?request=getfeature&service=wfs&version=1.0.0&typename=topp:states&filter=<Filter><PropertyIsEqualTo><PropertyName>STATE\_NAME</PropertyName><Literal/></PropertyIsEqualTo></Filter>http://localhost:8080/geoserver/wfs?request=getfeature&service=wfs&version=1.0.0&typename=topp:states&filter=<Filter><PropertyIsEqualTo><PropertyName>STATE\_NAME</PropertyName><Literal/></PropertyIsEqualTo></Filter <http://localhost:8080/geoserver/wfs?request=getfeature&service=wfs&version=1.0.0&typename=topp:states&filter=<Filter><PropertyIsEqualTo><PropertyName>STATE\_NAME</PropertyName><Literal/></PropertyIsEqualTo></Filter>&outputformat=json>>&outputformat=json
My reason for doing this is that I have a very large dataset and I am unable to load the entire /getfeature/ response as an object and split it from there.
Any help would be greatly appreciated.
Thank you.
*Grant McKenzie*
------------------------------------------------------------------------
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
Chris Holmes
OpenGeo - http://opengeo.org
Expert service straight from the developers.