Ticket #2102 (closed enhancement: fixed)

Opened 6 years ago

Last modified 2 years ago

[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

Changed 6 years ago by tomkralidis

  • 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

Changed 6 years ago by assefa

  • owner changed from mapserverbugs to assefa
  • status changed from new to assigned

Changed 6 years ago by assefa

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 ?

Changed 6 years ago by assefa

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

Changed 6 years ago by assefa

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

Changed 6 years ago by cplist

  • cc cplist added

Changed 6 years ago by assefa

Correct bugs. Tested with few cases. r6419

wxs test to be added.

Changed 6 years ago by tomkralidis

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

Changed 6 years ago by assefa

Is your layer wfs valid with DUMP TRUE set ?

Changed 6 years ago by tomkralidis

Whoops; it is now. Works now.

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

Changed 6 years ago by assefa

something like this would do ?

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

Changed 6 years ago by tomkralidis

Yes.

Changed 6 years ago by assefa

commited excpetion generation : r6424

Changed 6 years ago by tomkralidis

  • owner changed from assefa to jmckenna@…
  • status changed from assigned to new

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.

Changed 6 years ago by assefa

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.

Changed 6 years ago by assefa

  • milestone set to 5.0 release

Changed 6 years ago by jmckenna

  • owner changed from jmckenna@… to jmckenna

Changed 5 years ago by tomkralidis

  • component changed from WFS Server to MapServer Documentation
  • milestone changed from 5.0 release to 5.2 release

Changed 5 years ago by tomkralidis

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.

Changed 5 years ago by assefa

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

Changed 5 years ago by tomkralidis

Works. Thanks Assefa! Added msautotest in r7729 and r7734

Changed 2 years ago by tomkralidis

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.