[mapserver-users] How use the filteritem with a ogr spatialite db

Rahkonen Jukka jukka.rahkonen at mmmtike.fi
Thu Apr 4 12:05:57 PDT 2013


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>>
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>] 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>
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 àèìòù
-----------------


More information about the mapserver-users mailing list