[mapserver-users] queryByAttributes on PostGIS-Layer

schroeter at netgis.de schroeter at netgis.de
Thu May 29 02:55:20 EDT 2008


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
> 




More information about the mapserver-users mailing list