1

I have WMS and WFS services available to me and am trying to do the following:

I am trying to identify images(features) within a given BBOX using WFS, and then I want to retrieve the individual images through WMS GetMap based on the featureid from the WFS call.

The WFS query that I make is (URL modified to hide actual server information): http://www.wfsserver.com/catalogservice/wfsaccess/REQUEST=GetFeature&typeName=FinishedFeature&SERVICE=WFS&VERSION=1.1.0&BBOX=-73.8854994266476,40.6341176876158,-73.8606463081034,40.6501752378911,EPSG:4326&WIDTH=512&HEIGHT=512

My understanding of the above query:

  • I specify WFS as the service and GetFeature as the REQUEST type to pull metadata for the features.
  • I specify FinishedFeature as the feature type to get the data from (this is the name of the feature type that I happen to be using).
  • I specify a BBOX to restrict the area for which I want to pull the features from and specify EPSG:4326 as the SRS for the BBOX.
  • Width and Height is set to 512 (I don't know how this affects anything since I can change the values and still get the same results).

What I get in response is a Feature Collection GML that lists several Features for the BBOX that I specified.

<wfs:FeatureCollection xmlns:ogc="http://www.opengis.net/ogc" 
                       xmlns:wfs="http://www.opengis.net/wfs"
                       xmlns:ows="http://www.opengis.net/ows" 
                       xmlns:xlink="http://www.w3.org/1999/xlink" 
                       xmlns:gml="http://www.opengis.net/gml" 
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                       numberOfFeatures="21" timeStamp="2015-09-21T17:06:45.806Z"
                       xsi:schemaLocation="http://www.myServer.com">
    <gml:featureMembers>
        <FinishedFeature gml:id="16478949f5fc3c87ba329fcf608085a3">
            <featureId>16478949f5fc3c87ba329fcf608085a3</featureId>
            <geometry>
                 <gml:Polygon srsDimension="2" srsName="urn:x-ogc:def:crs:EPSG:4326">
                     <gml:exterior>
                         <gml:LinearRing srsDimension="2">
                             <gml:posList>
                                 40.81988700000292 -73.95899850000016 40.63913550005475 -73.95894900000025 40.64983200005168 -73.73234250038556 40.83001650000002 -73.7327880003848 40.81988700000292 -73.95899850000016
                             </gml:posList>
                         </gml:LinearRing>
                     </gml:exterior>
                 </gml:Polygon>
             </geometry>
             <acquisitionDate>2015-09-03 17:32:02</acquisitionDate>
             ............... and so forth

The WMS query that I do following the WFS query is:

https://www.wmsserver.com/mapservice/wmsaccess/SERVICE=WMS&REQUEST=GetMap&VERSION=1.1.1&LAYERS=Imagery&FORMAT=image%2Fjpeg&HEIGHT=512&WIDTH=512&SRS=EPSG:4326&BBOX=-73.70,40.60,-74.00,40.85&CQL_FILTER=featureid=%27464fd8ace00f7e8de1b0976b51a83042%27

My understanding of the above WMS query:

  • I specify WMS as the service and GetMap as the REQUEST type in order to retrive the image.
  • I specify Imagery as my layer (Not what it's actually named, but it's what I'm calling it here)
  • I specify JPEG as the imagery format.
  • I specify 512x512 for width and height, and that is the size the image gets returned in.
  • I specify EPSG:4326 to specify the SRS for the BBOX.
  • I specify the CQL_FILTER for a featureid filter and give the featureid that I got form the WFS query.

When I run the query without the CQL_FILTER, I get an image. However, the image appears to be a merging of all the images for that given BBOX. I thought that specifying the CQL_FILTER on featureid would give me the one specific image instead of all the images. So, when I do apply the CQL_FILTER, what I get is a blank image that is all white. Running all the features and their featureid through the CQL_FILTER will give me a single white image for every single one.

In my head, what I am doing is very simple: Get all of the images (features) within a given BBOX using WFS. Run results through WMS GetMap with a featureid CQL Filter to get all the images individually from within that BBOX.

Is there anything that I am doing which is obviously wrong? Could this be a problem with our server?

  • 1
    If you get a fid like gml:id="16478949f5fc3c87ba329fcf608085a3" it means that GeoServer does not find a primary key from your datasource. The fid is generated on-the-fly and it is very likely unique but it is not stable. What datastore are you using? If it is PostGIS make sure that the table has a primary key. – user30184 Sep 21 '15 at 20:10
  • When you say 'not stable', do you mean that the IDs will change? I am looking at the WFS response that I saved from several days ago, and the results are the same with exception of the timestamp. Would that have any bearing, or is the fact that the server generating IDs that look like GUIDs a problem in and of itself? – BoJoe22 Sep 21 '15 at 20:56
  • I thought they could change but I may be wrong. I would still follow this document docs.geoserver.org/stable/en/user/data/database/primarykey.html. – user30184 Sep 21 '15 at 21:26
  • As it turns out the vendor stood up GeoServer without the CQL_FILTER parameter properly working, and instead has an undocumented parameter to filter the GetMap query by feature. For the user that followed through with me on this question, I would like to give you credit if you add an answer. Is that allowed? – BoJoe22 Sep 21 '15 at 22:50
  • 1
    Rather write your own answer and I will upvote it. It would be nice also to write a mail to geoserver-users list and suggest how to improve the documentation. – user30184 Sep 22 '15 at 4:36
2

In the very end, I got a response from the vendor a month after we stopped working on the project. The vendor's response was that I was using the wrong letter casing in the CQL_FILTER parameters. The 'featureid' parameter needed to have a capital 'i' so that it ends up as 'featureId'. I tested my original WMS query with the single letter change, and sure enough, my original WMS query worked great.

  • Apologies for the late answer and to the people that have come across this question. But I wanted to answer the question since I noticed that people were still coming by and trying to answer it. – BoJoe22 Jun 1 '16 at 1:01
1

I don't think what you are trying to do is possible within a standard WMS interface. A WMS doesn't have any concept of a featureid, so you can't apply any filter based on a featureid in a GetMap request. A WMS does have a GetFeatureInfo request but such a request doesn't operate on a featureid, rather it uses a pixel coordinate on the image returned in a GetMap request.

-2

you cant apply bbox and cql_filter in the same query, you should try bbox tool inside cql_filter but you cant specify srs of the box

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.