Ticket #3414 (reopened defect)

Opened 3 years ago

Last modified 3 years ago

WFS client: add ogc: namspace to filter generated by Mapserver

Reported by: assefa Owned by: assefa
Priority: normal Milestone: 5.6.4 release
Component: WFS Client Version: unspecified
Severity: normal Keywords:
Cc: miloslav.kmet@…

Description

Filter generated by Mapserver does not include the ogc namespace.

reprorted through mapserver list (miloslav.kmet@…)

Hello.

I need to find a solution how to filter ArcGIS wfs service in mapserver WFS client. I read this document: http://mapserver.org/ogc/filter_encoding.html and there is no topic about xml ns prefixes in filter.

It seems, that esri's wfs services need xml namespace ogc: in every filter element.

I tried id with get from browser and this works as expected: <ogc:Filter><ogc:PropertyIsEqualTo><ogc:PropertyName>eia_eia:IDAKCIA</ogc:PropertyName><ogc:Literal>1833</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter> ?service=wfs&version=1.1.0&request=getFeature&typename=eia_eia:EIA_Locality&filter=%3Cogc:Filter%3E%3Cogc:PropertyIsEqualTo%3E%3Cogc:PropertyName%3Eeia_eia:IDAKCIA%3C/ogc:PropertyName%3E%3Cogc:Literal%3E1833%3C/ogc:Literal%3E%3C/ogc:PropertyIsEqualTo%3E%3C/ogc:Filter%3E (tinyurlized:  http://tinyurl.com/yanqfry)

But this won't filter anything and gives me all features: <Filter><PropertyIsEqualTo?><PropertyName?>eia_eia:IDAKCIA</PropertyName><Literal>1833</Literal></PropertyIsEqualTo></Filter> ?service=wfs&version=1.1.0&request=getFeature&typename=eia_eia:EIA_Locality&filter=%3CFilter%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Eeia_eia:IDAKCIA%3C/PropertyName%3E%3CLiteral%3E1833%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E (tinyurlized:  http://tinyurl.com/y9t3rld)

I doubt, that I can get some response from Esri on this topic, because of this thread:  http://forums.esri.com/Thread.asp?c=158&f=2276&t=273488 where folks

So the question is - how to add the ogc: namespace prefix into wfs_filter?

This is how I have configured the WFS in my mapfile:

CONNECTIONTYPE WFS CONNECTION

" http://globus.sazp.sk/arcgis/services/eia/eia/mapserver/wfsserver"

METADATA

"wfs_version" "1.0.0" "wfs_service" "WFS" "wfs_request_method" "GET" "wfs_srs" "EPSG:4326" "wfs_typename" "eia_eia:EIA_locality" "wfs_filter"

"<PropertyIsEqualTo?><PropertyName?>eia_eia:IDAKCIA</PropertyName><Literal>1833</Literal></PropertyIsEqualTo>"

"wfs_maxfeatures" "1000"

END

Thank you.

Change History

Changed 3 years ago by assefa

  • status changed from new to closed
  • resolution set to fixed

committed in trunk r10040 in 5.6.x branch r10041

Changed 3 years ago by assefa

Miloslav,

Please update/reopen this bug if any problems.

Thanks

Changed 3 years ago by assefa

  • status changed from closed to reopened
  • resolution fixed deleted

Changed 3 years ago by assefa

add also the name spaces.

Miloslav, would something like this should work? Please take the time to update this bug to confirm or not the fixes since I do not have Arc to test it.

<?xml version="1.0" ?><wfs:GetFeature service="WFS" version="1.0.0" maxFeatures="10000" outputFormat="GML2"

xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs  http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">

<wfs:Query typeName="nps:MCHU"> <ogc:Filter> <ogc:BBOX> <ogc:PropertyName>Geometry</ogc:PropertyName> <gml:Box> <gml:coordinates>-613875.000000,-1351366.235392 -143625.000000,-1116633.764608</gml:coordinates> </gml:Box> </ogc:BBOX> </ogc:Filter></wfs:Query> </wfs:GetFeature>

Changed 3 years ago by adrive

Hi, sorry for a later response, caused by our ESRI supplier. The solution you proposed above won't work for me.

However after some bothering, I got two working XML.

POST /arcgis/services/nipi/protected_sites/MapServer/WFSServer?SERVICE=WFS HTTP/1.1
User-Agent: MapServer/5.6.3 libcurl/7.19.7
Host: globus.sazp.sk
Accept: */*
Content-Type: application/xml
Connection: close
Content-Length: 506

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:cgf="http://www.opengis.net/cite/geometry" outputFormat="GML2" version="1.0.0" maxFeatures="2" service="WFS">
<wfs:Query typeName="esri:mchu">
<gml:boundedBy>
<gml:Box srsName='EPSG:102067'>
<gml:coordinates>-590983.8238170041,-1332953.64061642 -165436.87993268299,-1139523.52818027</gml:coordinates>
</gml:Box>
</gml:boundedBy>
</wfs:Query>
</wfs:GetFeature>
POST /arcgis/services/nipi/protected_sites/MapServer/WFSServer?SERVICE=WFS HTTP/1.1
User-Agent: MapServer/5.6.3 libcurl/7.19.7
Host: globus.sazp.sk
Accept: */*
Content-Type: application/xml
Connection: close
Content-Length: 749

<?xml version="1.0" encoding="utf-8"?>
<wfs:GetFeature service="WFS" version="1.0.0" maxFeatures="10000" outputFormat="GML2" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nps="http://globus.sazp.sk/arcgis/services/nipi/protected_sites/MapServer/WFSServer" xsi:schemaLocation="http://www.opengis.net/wfshttp://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
  <wfs:Query typeName="nps:MCHU">
    <ogc:PropertyName>Geometry</ogc:PropertyName>
      <gml:Box>
        <gml:coordinates>-613875.000000,-1351366.235392 -143625.000000,-1116633.764608</gml:coordinates>
      </gml:Box>
  </wfs:Query>
</wfs:GetFeature>

The difference is in the missing <ogc:Filter|BBOX> in <wfs:Query.

Don't hesitate to play with our  WFS service

Thank you!

Changed 3 years ago by assefa

I am not sure, but I do not believe that the 2 xmls are valid. What schema is used to validate the xml? Mapserver generate wfs 1.0.0 type request and the xml I described earlier in this bug validates against the  http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd

Note: See TracTickets for help on using tickets.