[mapserver-users] queryByAttributes on PostGIS-Layer
Daniel Morissette
dmorissette at mapgears.com
Thu May 29 08:14:34 PDT 2008
I'm not sure if a "fix" is possible since queryByAttributes() works by
setting the FILTERITEM/FILTER on the layer, so this behavior is kinda
normal since the PostGIS FILTER syntax differs from the FILTER syntax
used by shapefile layers.
Perhaps it's more a documentation issue and the various MapScript docs
should make the above clearer.
Daniel
Paul Ramsey wrote:
> Well, if it's presenting a markedly different API than a query on
> shape file, I'd say it is at minimum non-optimal and worthy of a
> ticket. Of course, at this late date, "fixing" it will break everyone
> else's code... oh, dear :)
>
> P
>
> On Wed, May 28, 2008 at 11:55 PM, <schroeter at netgis.de> wrote:
>> Found the problem (thanks to Nicol ;-)
>> Code:
>> @$myQuery = $layer->queryByAttributes('nr_','7', MS_SINGLE);
>>
>> must be changed to:
>> @$myQuery = $layer->queryByAttributes('nr_','nr_=7', MS_SINGLE);
>>
>> Is this a bug?
>>
>> Sven
>>
>>
>> ----- Original Message ----- From: <schroeter at netgis.de>
>> To: <mapserver-users at lists.osgeo.org>
>> Sent: Wednesday, May 28, 2008 12:48 PM
>> Subject: [mapserver-users] queryByAttributes on PostGIS-Layer
>>
>>
>>> Hallo list,
>>>
>>> My test-system: Mapserver 5.02 on WinXP and postgreSQL 8.2
>>> I try to make some querys via php-mapscript for a postgis-layer:
>>> queryByPoint,queryByShape and queryByRect is no problem.
>>> queryByAttributes always return "no result" (field 'nr_' is an integer)
>>> If I use a shapefile for the same data (biogasanlagen.shp)
>>> queryByAttributes works fine.
>>>
>>> mapfile:
>>> ...
>>> LAYER
>>> NAME "biogasanlagen"
>>> TYPE point
>>> STATUS on
>>> CONNECTIONTYPE postgis
>>> CONNECTION "user=postgres password=xyz dbname=mydb host=localhost
>>> port=5432"
>>> DATA "the_geom from biogasanlagen using unique gid"
>>> #DATA biogasanlagen.shp
>>> TEMPLATE void
>>> CLASS
>>> Name "biogasanlagen"
>>> OUTLINECOLOR 128 70 0
>>> COLOR 230 70 0
>>> SYMBOL 'circle'
>>> SIZE 12
>>> END # CLASS
>>> TRANSPARENCY 88
>>> TOLERANCE 8
>>> END
>>> ...
>>>
>>> php-Code:
>>>
>>> ...
>>> $layer = $map->getLayerByName("biogasanlagen");
>>> @$myQuery = $layer->queryByAttributes('nr_','7', MS_SINGLE);
>>> ...
>>>
>>> any idea?
>>>
>>> Thanks Sven
>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
--
Daniel Morissette
http://www.mapgears.com/
More information about the MapServer-users
mailing list