[mapserver-users] Postgis syntax for qitem and qstring...
nikos at maich.gr
nikos at maich.gr
Wed Oct 27 08:07:40 PDT 2010
Hi,
Have searched around and have not really found any answers to this...
I know it's kinda beaten to death, but I'm still stuck...
My map file is ok, as layers and classes render correctly...
Trying to query a postgis layer vi a template
here's my query string sent to ms cgi..
queryfile=&img.x=257&img.y=171&zoomdir=1&zoomsize=2&map=/var/www/html/IUNG/IUNG.map&imgext=380423.595142
4328752.268235 396518.970142
4344847.643235&mapext=shape&layer=landunits&map.layer[landunits].class[landunits].style[0]=color
2 176
15&layer=settlements&map.layer[settlements].class[settlements].style[0]=color
255 255
0&layer=greehouses&map.layer[greenhouses].class[greenhouses].style[0]=color
0 0
255&layer=municipalities&map.layer[municipalities].class[municipalities].style[0]=color
255 125 0&layer=factories
&query_mode=itemquery
&qlayer=landunits
&qstring=[cyna>0]
&qitem=cyna
&tablename=default&w=450&h=450&landunits_color=1&settlements_color=3&greenhouses_color=2&municipalities_color=4&imgxy=225.0
225.0&mode=itemquery&rnd982g=0.5784547519648998&ID=1288191931&fname=/IUNG/tmp/IUNG1288191931.html
y&qlayer=landunits&qstring=[cyna > 0]&qitem=cyna
prepare_database(): Query error. Error declaring cursor: ERROR: column
"cyna" does not exist
LINE 1: DECLARE mycursor BINARY CURSOR FOR SELECT
"cyna"::text,asbin...
^
With query string: DECLARE mycursor BINARY CURSOR FOR SELECT
"cyna"::text,asbinary(force_collection(force_2d(the_geom)),'NDR'
),gid::text from (SELECT landunits.gid AS gid, landunits.the_geom AS
the_geom,
im_results.cot as cotton,
im_results.ble as wheat,
im_results.cyna as cynara,
im_results.misc as miscanthus
FROM landunits JOIN im_results ON
landunits.gid = im_results.ide1)
AS im_join WHERE (cyna > 0) and (the_geom && setSRID(
'BOX3D(338975.96875 4319199,391293.59375
4383580.5)'::BOX3D,-1) )
here's the relevant part of mapfile...
CONNECTION "dbname=IUNG user=postgres host=localhost password=salonica "
DATA "the_geom FROM (SELECT landunits.gid AS gid, landunits.the_geom
AS the_geom,
im_results.cot as cotton,
im_results.ble as ble,
im_results.cyna as cynara,
im_results.misc as miscanthus
FROM landunits JOIN im_results ON
landunits.gid = im_results.ide1)
AS im_join USING UNIQUE gid USING SRID=-1"
#####
##
#FILTER "gid > 0"
CLASS
Name "landunits"
OUTLINECOLOR 10 10 10
color 255 125 0
outlinecolor 25 25 255
template "templates/landunits_query.html"
END
CLASS
Name "gid"
OUTLINECOLOR 10 10 10
color 255 12 0
outlinecolor 25 25 255
template "templates/landunits_query.html"
END
Class
Name "total"
OUTLINECOLOR 10 10 10
color 255 125 0
outlinecolor 25 25 255
template "templates/landunits_query.html"
END Class
Name "cotton"
OUTLINECOLOR 10 10 10
color 255 125 0
outlinecolor 25 25 255
template "templates/landunits_query.html"
END
Class
Name "ble"
OUTLINECOLOR 10 10 10
color 255 125 0
outlinecolor 25 25 255
template "templates/landunits_query.html"
END
Class
Name "cynara"
OUTLINECOLOR 10 10 10
color 255 125 0
outlinecolor 25 25 255
template "templates/landunits_query.html"
END
ClaSS
Name "miscanthus"
OUTLINECOLOR 10 10 10
color 255 125 0
outlinecolor 25 25 255
template "templates/landunits_query.html"
END
I'm stuck...
regards,
nikos
More information about the MapServer-users
mailing list