[mapserver-users] queryByAttributes on PostGIS-Layer

Paul Ramsey pramsey at cleverelephant.ca
Thu May 29 11:49:37 EDT 2008


That makes some sense... but since the queryByAttribute code is based
on key/value combos, it could present a uniform API, even if it
implemented it different under the covers for shape/postgis. That
would actually reduce the functionality compared to right now, though,
since right now you can put any SQL filter you want into the API for
PostGIS.

On Thu, May 29, 2008 at 8:14 AM, Daniel Morissette
<dmorissette at mapgears.com> wrote:
> 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/
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>


More information about the mapserver-users mailing list