-1

I need to query this WFS public service

http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/Numeri_Civici_2012.map&service=WFS&request=GetCapabilities

The layer I need to query is this one

http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/Numeri_Civici_2012.map&service=WFS&version=1.0.0&request=DescribeFeatureType

It's a layer with a very big number of point features.

The OGC service is done using MapServer but I don't know the version.

I need to query this layer in a no spatial way: the simplest query I need to do is something like this one

http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/Numeri_Civici_2012.map&VERSION=1.0.0&service=WFS&request=GetFeature&TYPENAME=IN.NUMERICIVICI.2012&Filter=<Filter><PropertyIsEqualTo><PropertyName>id</PropertyName><Literal>13800000050414</Literal></PropertyIsEqualTo></Filter>

My final query would like to combine several clauses using the AND logical operator.

Unfortunately at the moment the simplest query above doesn't work: if you try it in the response the will be something like:

HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts

I've done several attempts to change it and I've tried other queries: for example

1) this one:

http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/Numeri_Civici_2012.map&VERSION=1.0.0&service=WFS&request=GetFeature&TYPENAME=IN.NUMERICIVICI.2012&Filter=%3Cogc:Filter%3E%3Cogc:PropertyIsEqualTo%3E%3Cogc:PropertyName%3Eid%3C/ogc:PropertyName%3E%3Cogc:Literal%3E%2713800000050414%27%3C/ogc:Literal%3E%3C/ogc:PropertyIsEqualTo%3E%3C/ogc:Filter%3E

returns

<gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy>

so I think that in this case the syntax could be right but I'm not sure and I don't understand because the response is null

2) trying to do a spatial query like this one:

http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/Numeri_Civici_2012.map&VERSION=1.0.0&service=WFS&request=GetFeature&TYPENAME=IN.NUMERICIVICI.2012&Filter=%3CFilter%3E%3CBBOX%3E%3CPropertyName%3EName%3ENAME%3C/PropertyName%3E%3CBox%20srsName=%27EPSG:4326%27%3E%3Ccoordinates%3E7.626630,45.029061%207.673107,45.052713%3C/coordinates%3E%3C/Box%3E%3C/BBOX%3E%3C/Filter%3E

returns a correct response.

I've found on the web that probably there is a workaround.

http://osgeo-org.1560.x6.nabble.com/WFS-filter-creates-a-query-using-a-number-instead-of-text-td5130361.html#a5190402

that suggest to use the PropertyIsLike operator instead of the PropertyIsEqual. I've tried to use it but it doesn't work in my case.

http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/Numeri_Civici_2012.map&VERSION=1.0.0&service=WFS&request=GetFeature&TYPENAME=IN.NUMERICIVICI.2012&Filter=%3Cogc:Filter%3E%3Cogc:PropertyIsLike%3E%3Cogc:PropertyName%3Eid%3C/ogc:PropertyName%3E%3Cogc:Literal%3E%2713800000050414%27%3C/ogc:Literal%3E%3C/ogc:PropertyIsLike%3E%3C/ogc:Filter%3E

in this case after a long time it seems that the service goes in time out and no data is returned.

Now I am completely blocked.

Any suggestions / workaround?

0

The solution is described here http://osgeo-org.1560.x6.nabble.com/How-to-use-filter-encoding-in-MapServer-in-a-WFS-query-td5205424.html.

It seems that is an old problem with int considered as string and the solution is really to use PropertyIsLike operator instead of the PropertyIsEqual but be careful about the sintax ....

Here you're a couple examples ....

the first one ...

http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/Numeri_Civici_2012.map&VERSION=1.1.0&service=wfs&request=GetFeature&TYPENAME=IN.NUMERICIVICI.2012&Filter=%3Cogc:Filter%20xmlns:ogc=%22http://www.opengis.net/ogc%22%3E%3Cogc:PropertyIsLike%20matchCase=%22false%22%20wildCard=%22*%22%20singleChar=%22.%22%20escapeChar=%22!%22%3E%3Cogc:PropertyName%3Eid%3C/ogc:PropertyName%3E%3Cogc:Literal%3E*13800073301968*%3C/ogc:Literal%3E%3C/ogc:PropertyIsLike%3E%3C/ogc:Filter%3E

the second one ....

http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/Numeri_Civici_2012.map&VERSION=1.1.0&service=wfs&request=GetFeature&TYPENAME=IN.NUMERICIVICI.2012&Filter=<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:PropertyIsLike matchCase="false" wildCard="*" singleChar="." escapeChar="!"><ogc:PropertyName>id</ogc:PropertyName><ogc:Literal>*13800000050414*</ogc:Literal></ogc:PropertyIsLike></ogc:Filter>

The service is quite slow so, wait for the response ...

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.