problem in Dynamic query with postGIS

nimalika Fernando nimalikaf at YAHOO.COM
Thu Mar 1 04:52:57 EST 2007


hi everybody,

I am working in a disaster recovery application  , using Mapserver and postGIS 
for mapping part.

I need to implement a simple search facilty, for eaxmple if user already knows 
a village affected , by selecting that village name using a combo box in web 
interface the related village should be highlighted in the map.

I am not clear about how to implement such but I tried several options. 
I have used a QUERYMAP object and tried . But I am not getting the work 
done. My data resides in postGIS db and working with Maapserver in CGI mode 
is fine for basic operations.
My query in the map file  is as follows

DATA "the_geom from (select alldsdivisions.the_geom as
the_geom,alldsdivisions.gid as oid , 
alldsdivisions.dsd_n as  dsd_n from alldsdivisions 
where alldsdivisions.dsd_n ='%qstring%')

error mesage I get is as follows

 prepare_database(): Query error. Error executing POSTGIS DECLARE (the
 actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT
 dsd_n::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),oid::text 
from (select alldsdivisions.the_geom as the_geom,alldsdivisions.gid as oid , 
alldsdivisions.dsd_n as dsd_n from alldsdivisions where alldsdivisions.dsd_n 
='Ambalanthota') AS selectedgs WHERE (Ambalanthota) and (the_geom && 
setSRID( 'BOX3D(181659.373889 74242.41425975,303213.047119 
165407.66918225)'::BOX3D,-1) )' 
 
Postgresql reports the error as 'ERROR: column "ambalanthota" does not
exist '
 
here , "Ambalanthota" mean a value of coumn dsd_n of table
alldsdivisions. qstring is replaced by the user selected value of the combo box.

I have tried to get help from postGIS users but still i couldn't solve this

can anybody help me to figure out a solution , pls?
 
thank you in advance,
  
Nimalika
from Sri Lanka



More information about the mapserver-users mailing list