<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>PHP_Mapscript QueryByAttributes on PostGIS layer - bug or feature?</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=912262723-20092006><FONT face=Arial
color=#0000ff size=2>Hi Sergio,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=912262723-20092006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=912262723-20092006><FONT face=Arial
color=#0000ff size=2>Thanks for that. I am not sure if a QueryByPoint would help
for me, but I just change the querystring for PostGIS. It's not clean and
abstract, but for now that will have to do. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=912262723-20092006><FONT face=Arial
color=#0000ff size=2>I didn't manage to find the post you mentioned. Was it on
the MapServer list?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=912262723-20092006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=912262723-20092006><FONT face=Arial
color=#0000ff size=2>regards,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=912262723-20092006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=912262723-20092006><FONT face=Arial
color=#0000ff size=2>Jacob</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=912262723-20092006></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=912262723-20092006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=912262723-20092006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Sergio López
[mailto:sergiodlopez@yahoo.com] <BR><B>Sent:</B> 20 September 2006
23:39<BR><B>To:</B> Delfos, Jacob<BR><B>Subject:</B> Re: [UMN_MAPSERVER-USERS]
PHP_Mapscript QueryByAttributes on PostGIS layer - bug or
feature?<BR></FONT><BR></DIV>
<DIV></DIV>Jacob<BR>I had the same problem, and I think is a bug. I've solved
it by implementing a query by point using POSTGIS spatial queries, because I
use only Postgis layers. There is a post with the explanation (in spanish, i'm
afraid). search the list , the subject of the post was "Possible bug", in may
2006.<BR>Sergio<BR><BR><B><I>"Delfos, Jacob"
<Jacob.Delfos@MAUNSELL.COM></I></B> escribió:
<BLOCKQUOTE class=replbq
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid">
<META content="MS Exchange Server version 6.5.7226.0" name=Generator><!-- Converted from text/rtf format -->
<DIV><FONT face=Arial size=2>Hi List,</FONT> </DIV>
<DIV><FONT face=Arial size=2>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?</FONT></DIV>
<DIV><FONT face=Arial size=2>My code is:</FONT> </DIV>
<DIV><FONT face=Arial size=2> $gotResult =
$oLayer->queryByAttributes("roadname","EMERALD RD",MS_MULTIPLE);</FONT>
</DIV>
<DIV><FONT face=Arial size=2>My PHP error is:</FONT> </DIV>
<DIV><FONT face="Courier New" size=2>[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></FONT></DIV>
<DIV><FONT face=Arial size=2>It works if I do:</FONT> </DIV>
<DIV><FONT face=Arial
size=2>$oLayer->queryByAttributes("roadname","roadname like 'EMERALD
RD'",MS_MULTIPLE);</FONT> </DIV>
<DIV><FONT face=Arial size=2>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….</FONT></DIV>
<DIV><FONT face=Arial size=2>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).</FONT></DIV>
<DIV><FONT face=Arial size=2>Regards,</FONT> </DIV>
<DIV><FONT face=Arial size=2>Jacob</FONT> </DIV><BR>
<DIV><B><FONT face=Arial color=#009500>J</FONT><FONT face=Arial
color=#009500 size=1>ACOB</FONT> <FONT face=Arial
color=#009500>D</FONT><FONT face=Arial color=#009500
size=1>ELFOS<BR></FONT><FONT face=Arial color=#009500>GIS</FONT><FONT
face=Arial color=#009500 size=1></FONT> <FONT face=Arial
color=#009500>A</FONT><FONT face=Arial color=#009500
size=1>NALYST</FONT><BR></B><FONT face=Arial color=#000000 size=2>Maunsell
Australia Pty Ltd<BR>629 Newcastle Street, Leederville, WA 6007</FONT>
<BR><FONT face=Arial color=#000000 size=2>PO Box 81, Leederville, WA
6902</FONT> <BR><FONT face=Arial color=#000000 size=2>Western
Australia</FONT> <BR><FONT face=Arial color=#000000 size=2>ABN 20 093 846
925<BR><BR>Tel + 61 8 9281
6185<BR>Fax + 61 8 9281 6297<BR></FONT><U><FONT face=Arial
color=#009c21 size=2>jacob.delfos@maunsell.com</FONT></U>
</DIV></BLOCKQUOTE><BR>
<P>
<HR SIZE=1>
<B>Preguntá. Respondé. Descubrí.</B><BR>Todo lo que querías saber, y lo que ni
imaginabas,<BR>está en <B>Yahoo! Respuestas</B> (Beta).<BR><B><A
href="http://ar.answers.yahoo.com">Probalo ya!</A></B>
</BLOCKQUOTE></BODY></HTML>