[mapserver-users] How use the filteritem with a ogr spatialite db
Rahkonen Jukka
jukka.rahkonen at mmmtike.fi
Thu Apr 4 13:21:01 PDT 2013
Hi,
This feels like a bug. I never filed a bug about my SLD_BODY problem but I will do it now because you have somehow confirmed that the trouble exists. In our case we have a shapefile with a field
JARVINUMER: String (15.0)
If we used value 04.186.1.004 in the filter no features were found but after updating the shapefile and usind string K04.186.1.004 instead the desired feature gets selected.
&SLD_BODY=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%3CStyledLayerDescriptor+version%3D%221.1.0%22%3E%3CNamedLayer%3E%3CName%3Ekaveri_jarvet%3C%2FName%3E%3CUserStyle%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CName%3ERule+1%3C%2FName%3E%3Cogc%3AFilter%3E%3Cogc%3APropertyIsEqualTo%3E%3Cogc%3APropertyName%3EJARVINUMER%3C%2Fogc%3APropertyName%3E%3Cogc%3ALiteral%3E04.186.1.004%3C%2Fogc%3ALiteral%3E%3C%2Fogc%3APropertyIsEqualTo%3E%3C%2Fogc%3AFilter%3E%3CPolygonSymbolizer%3E%3CStroke%3E%3CCssParameter+name%3D%22stroke%22%3E%2300FFFF%3C%2FCssParameter%3E%3CCssParameter+name%3D%22stroke-width%22%3E1%3C%2FCssParameter%3E%3C%2FStroke%3E%3CFill%3E%3CCssParameter+name%3D%22fill%22%3E%2300FFFF%3C%2FCssParameter%3E%3CCssParameter+name%3D%22fill-opacity%22%3E1%3C%2FCssParameter%3E%3C%2FFill%3E%3C%2FPolygonSymbolizer%3E%3Csld%3ATextSymbolizer%3E%3Csld%3ALabel%3E%3Cogc%3APropertyName%3ENIMI_FI%3C%2Fogc%3APropertyName%3E%3C%2Fsld%3ALabel%3E%3Csld%3AFont%3E%3Csld%3ACssParameter+name%3D%22font-family%22%3EArial%3C%2Fsld%3ACssParameter%3E%3Csld%3ACssParameter+name%3D%22font-size%22%3E12%3C%2Fsld%3ACssParameter%3E%3C%2Fsld%3AFont%3E%3Csld%3AFill%3E%3Csld%3ACssParameter+name%3D%22fill%22%3E%23000000%3C%2Fsld%3ACssParameter%3E%3C%2Fsld%3AFill%3E%3C%2Fsld%3ATextSymbolizer%3E%3C%2FRule%3E%3C%2FFeatureTypeStyle%3E%3C%2FUserStyle%3E%3C%2FNamedLayer%3E%3C%2FStyledLayerDescriptor%3E
-Jukka Rahkonen-
________________________________
Andrea Peri wrote:
> Hi Jukka,
> after an update I try using
> 'default_idtpn' 'S%'
> and surprising me it work !
> Meanwhile I try to define the default as a simply %
> 'default_idtpn' '%'
> but it don't work.
> So it need not only a text field but a text field starting with a character. Very rarely situation in our primarykey fields. :(
> Thx for support,
Andrea.
2013/4/4 Rahkonen Jukka <jukka.rahkonen at mmmtike.fi<mailto:jukka.rahkonen at mmmtike.fi>>
Hi Andrea,
Could you make test by using something else than '9%' as variable default value, for example 'K9%'? We have had troubles with selecting atrribute values like "04.186.1.004" with SLD_BODY. We had to update the attributes into "K04.186.1.004" for making filtering to work. Obviously Mapserver was surprised in seeing two dots in a string that starts with a numeric character. Your type mismatch error makes me wonder if there could be something similar in your case.
-Jukka Rahkonen-
________________________________
Andrea Peri wrote:
> Thx Steve.
> It work ,
> Just to do a step forward I try also to define as default a wildcard
> using this sintax
> I try settings like this:
> FILTER "WHERE ID_ING = '%idtpn%' "
> metadata
> 'default_idtpn' '9%'
...
> But the mapserver return an error.
> msOGRFileWhichShapes(): OGR error. SetAttributeFilter(ID_ING LIKE '9%') failed on layer rt_speleologia.idingrotte.rt.
> Type mismatch or improper type of arguments to LIKE operator.
> Reading the gdal/ogr documentation this sintax should be allowed in the OGRSQL. I use gdal 1.9.1 and it seem to support the wildcard option.
> So perhaps this could be a real bug of gdal.
> I ask to gdal ML.
2013/4/4 Lime, Steve D (MNIT) <Steve.Lime at state.mn.us<mailto:Steve.Lime at state.mn.us><mailto:Steve.Lime at state.mn.us<mailto:Steve.Lime at state.mn.us>>>
Filter should look like:
FILTER (ID_ING = '%idtpn%' )
If MapServer is to execute it, or:
FILTER "WHERE ID_ING = '%idtpn%' "
If OGR is to execute it.
Steve
From: mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org><mailto:mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org>> [mailto:mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org><mailto:mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org>>] On Behalf Of Andrea Peri
Sent: Thursday, April 04, 2013 8:26 AM
To: mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org><mailto:mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>>
Subject: [mapserver-users] How use the filteritem with a ogr spatialite db
Hi,
I'm try-ing to apply a filter to a spatialite db by ogr .
I try this
CONNECTIONTYPE OGR
CONNECTION "/.../tematici.sqlite"
DATA "select PK_UID,ID_ING,ID_GRO,NUMERO,NOME,CODCOM,COMUNE,ANNO,DATA_AGG,SCHEDA,RILIEVO,CGBEST,CGBNORD,GEOMETRY from SPELEOLOGIA_INGRESSI_GROTTE"
FILTER "(ID_ING = '%idtpn%' )"
FILTERITEM 'ID_ING'
VALIDATION
'idtpn' '^[a-zA-Z0-9\-_]+$'
END
.....
METADATA
'default_idtpn' '901707'
.....
But it don't work.
There is some sample of filter usage with ogr format ?
thx,
--
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
--
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
--
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
More information about the MapServer-users
mailing list