PHP_Mapscript QueryByAttributes on PostGIS layer - bug or feature?

Delfos, Jacob Jacob.Delfos at MAUNSELL.COM
Mon Sep 18 21:05:54 EDT 2006


Hi List,

I'm trying to perform a QueryByAttributes operation on a PostGIS layer, but I get an error. Basically, it seems that the where clause being generated leaves out the attribute name and operator. Am I doing something wrong?

My code is:

   $gotResult = $oLayer->queryByAttributes("roadname","EMERALD RD",MS_MULTIPLE);

My PHP error is:

[19-Sep-2006 08:53:34] PHP Warning:  [MapServer Error]: prepare_database(): Error executing POSTGIS DECLARE (the actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT roadname::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text from roads WHERE (EMERALD RD) and (the_geom && setSRID( 'BOX3D(-149999998.5 -99999999,149999998.5 99999999)'::BOX3D,find_srid('','roads','the_geom') ))' <br><br>

It works if I do:

$oLayer->queryByAttributes("roadname","roadname like 'EMERALD RD'",MS_MULTIPLE);

Am I supposed to perform the QueryByAttributes operation differently for different data sources? It gets more difficult if I don't know in advance whether the type is text or number....
I searched the list and bugzilla for something similar, but couldn't find it. I'm using php_mapscript 4.8.3 (I tried using 4.10beta2, but all my mapfiles get invalid map extent errors for some reason).

Regards,

Jacob


JACOB DELFOS
GIS ANALYST
Maunsell Australia Pty Ltd
629 Newcastle Street, Leederville, WA 6007
PO Box 81, Leederville, WA 6902
Western Australia
ABN 20 093 846 925

Tel     + 61 8 9281 6185
Fax    + 61 8 9281 6297
jacob.delfos at maunsell.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060919/7dfed14c/attachment.html


More information about the mapserver-users mailing list