Opened 17 years ago

Closed 13 years ago

#2102 closed enhancement (fixed)

[OGC:WFS] support query by featureid

Reported by: tomkralidis Owned by: jmckenna
Priority: normal Milestone: 5.6 release
Component: Documentation - MapServer Version:
Severity: normal Keywords:
Cc: sdlime, assefa, cplist

Description

OGC:WFS allows for GetFeature queries by feature id.

Use cases:

1./ WFS request HTTP GET with KVP

..and through WFS KVP, like:

http://example.org/wfs?service=WFS&version=1.0.0&request=GetFeature&featureid=roads.1013.

Note that, if featureid is found in the KVP, then typename is NOT required. Otherwise typename continues as mandatory.

2./ WFS request HTTP POST with Filter:

<?xml version="1.0" ?> <wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2" xmlns:myns="http://www.someserver.com/myns" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs ../wfs/1.0.0/WFS-basic.xsd"> <wfs:Query typeName="myns:INWATERA_1M"> <ogc:Filter> <ogc:FeatureId fid="INWATERA_1M.1234"/> </ogc:Filter> </wfs:Query> </wfs:GetFeature>

FYI the KVP featureid is mutually exclusive with Filter and BBOX and can be one or more (comma separated) values. So we don't have to implement WFS HTTP GET with Filter encocding on Feature id (the logic being that this would be passed as a KVP request).

Background info:

OGC:WFS 1.0.0: http://portal.opengeospatial.org/files/?artifact_id=7176 OGC:FES 1.0.0: http://portal.opengeospatial.org/files/?artifact_id=1171

Info:

  • the code would basically process the WFS request. If a feature filter (either case above), the a query by id type routine would be called against the column defined by MAP/LAYER/METADATA/gml_featureid

Issues:

  • what happens if MAP/LAYER/METADATA/gml_featureid is NOT defined?

I'm not sure if this can be done in time for 5.0 (Steve: comments?), so I have not set a milestone.

Change History (22)

comment:1 by tomkralidis, 17 years ago

Cc: assefa added

correspondence from Assefa:

I think the work to be done is the following:

  • add in the parsing code a support <Filter> with ogc:FeatureIds.
  • as suggested I think we could build a valid <Filter> when used through WFS KVP

comment:2 by assefa, 17 years ago

Owner: changed from mapserverbugs to assefa
Status: newassigned

comment:3 by assefa, 17 years ago

The inention is to build an expression that looks something like:

([ows_feature_id_value] = value_in_filter1 OR [ows_feature_id_value] = value_in_filter2 ...)

This expression would be set on the filter element of the layer.

  • which metadata should we use to lookup the featureid attribute ( msOWSLookupMetadata(&(lp->metadata), "OFG", "featureid") ??)
  • do I need to take into account the namespace prefix attached to the featureid value (eg INWATERA_1M.1234) ? I guess I need to remove it before building the expression ?

comment:4 by assefa, 17 years ago

Initial support added for the HTTP POST with Filter and also a HTTP Get with a <Filter> parameter (r6370).

comment:5 by assefa, 17 years ago

Tom, is there a chache to do more testing on it in the coming days. I have started a bit and will correct bugs as I go (hopefully will be finsihed by the end of the week ready for beta2). Then more tests can be done on it

comment:6 by cplist, 17 years ago

Cc: cplist added

comment:7 by assefa, 17 years ago

Correct bugs. Tested with few cases. r6419

wxs test to be added.

comment:8 by tomkralidis, 17 years ago

I can't get HTTP GET working (on trunk).

URL: http://devgeo.cciw.ca/cgi-bin/mapserv/sostest?service=WFS&version=1.0.0&request=GetFeature&featureid=observations.1990000162&

ows_featureid is set. However, when trying through ogrinfo I get results:

$ ogrinfo -al -where "SAMPLE_NU=1990000162" data/sos_test.shp

comment:9 by assefa, 17 years ago

Is your layer wfs valid with DUMP TRUE set ?

comment:10 by tomkralidis, 17 years ago

Whoops; it is now. Works now.

We should throw an exception if the layername / typename doesn't exist.

comment:11 by assefa, 17 years ago

something like this would do ?

msWFSGetFeature(): WFS server error. Invalid typename given with FeatureId in GetFeature : observationss

comment:12 by tomkralidis, 17 years ago

Yes.

comment:13 by assefa, 17 years ago

commited excpetion generation : r6424

comment:14 by tomkralidis, 17 years ago

Owner: changed from assefa to jmckenna@…
Status: assignednew

We should document the fact that we now need DUMP TRUE and gml_include_items. Before these weren't needed in the SOS implementation. Now they are.

Reassigned to Jeff for 5.0 docs.

comment:15 by assefa, 17 years ago

The FilterEncoding doc should be updated with the FeatureId support.

Section 2 "Currently Supported Features" should have a new entry Feature Identifier with the following text : "FeatureId support added in 5.0. Note that the ows/wfs/gml_featureid must be defined on the layer to be able to search using a feature id"

I think the DUMP TRUE and gml_include_items are already documeneted with the wfs spec.

comment:16 by assefa, 17 years ago

Milestone: 5.0 release

comment:17 by jmckenna, 17 years ago

Owner: changed from jmckenna@… to jmckenna

comment:18 by tomkralidis, 16 years ago

Component: WFS ServerMapServer Documentation
Milestone: 5.0 release5.2 release

comment:19 by tomkralidis, 16 years ago

Assefa: in doing some research for #2599, I tested this again:

$ cd trunk/msautotest/wxs/
$ ../../mapserver/mapserv QUERY_STRING="map=wfs_simple.map&service=WFS&version=1.0.0&request=GetFeature&typename=province&featureid=province.Quebec"

...and I get all the features returned. I tried this on another WFS and got all the results again. Did something happen since this was implemented?

Please advise.

comment:20 by assefa, 16 years ago

tom, It was broken for some time. It should now work (r7733). Good thing that your are adding the msautotest.

comment:21 by tomkralidis, 16 years ago

Works. Thanks Assefa! Added msautotest in r7729 and r7734

comment:22 by tomkralidis, 13 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.