Search code examples
mapsgeoserver

WFS GetFeature with multiple layers and different propertyNames


Suppose i have a Geoserver running with two layers exposed by WFS (with properties):

StreetLayer (geom, StreetName, Lanes, Length)
HouseLayer (geom, Address)

Now if i want to query StreetLayer for all streets but only get the StreetName and Lanes properties I'd send a GET request to this:

http://geoserver/wfs?REQUEST=GetFeature&VERSION=1.1.0&typename=StreetLayer&propertyname=StreetName,Lanes

But what if i now want to query both HouseLayer and StreetLayer? This doesn't work:

http://geoserver/wfs?REQUEST=GetFeature&VERSION=1.1.0&typename=StreetLayer,HouseLayer&propertyname=StreetName,Lanes,Address

I get an exception that says that StreetName and Lanes isn't in HouseLayer and vice versa. Do i need to make multiple requests?

EDIT:

So what i want to do is something like this:

http://geoserver/wfs?REQUEST=GetFeature&VERSION=1.1.0&typename=StreetLayer,HouseLayer&propertyname=(StreetName,Lanes),(Address)

Solution

  • Almost there, you just have an extra comma in propertyName. This one works against the vanilla GeoServer install:

    http://localhost:8087/gswps/topp/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=topp:tasmania_cities,topp:tasmania_roads&propertyName=(ADMIN_NAME,CITY_NAME)(TYPE)
    

    The difference: No comma between ) and (