[Mapserver-users] Itemquery - zooming to features

Ryan, Adam ARyan at co.linn.or.us
Wed Jul 7 20:02:14 EDT 2004


Mike,

1. Put the layer names in quotes.

2. The end of your url is '&mode=itemquery&qlayer=tuspoly&site_id=1003'.
Instead, try something like...

'&mode=itemquery&qlayer=tuspoly&qitem=site_id&qstring=1003', or something
like 

'&mode=itemquery&qlayer=tuspoly&qstring=([site_id]=1003)', if the field is
numeric or something like

'&mode=itemquery&qlayer=tuspoly&qstring=([site_id]="1003")', if the field is
text.

My syntax is probably off but you get the picture.

Check the cgi doc at http://mapserver.gis.umn.edu/doc42/cgi-reference.html

Hope it helps,

Adam Ryan
GIS Analyst
Linn County GIS Department
County Courthouse / Room 25
300 SW Fourth Ave.
Albany, OR 97321
541.812.8760
aryan at co.linn.or.us
 
-----Original Message-----
From: Mike Reilly [mailto:mikereilly_7 at hotmail.com] 
Sent: Wednesday, July 07, 2004 3:38 PM
To: mapserver-users at lists.gis.umn.edu
Subject: [Mapserver-users] Itemquery - zooming to features


I have a mapserver application running quite nicely and now want to add the 
ability to create a link that brings up a map zoomed in to a feature based 
on that features SITEID field in a dbf file.  This feature is similar to 
that shown at this tutorial in case 1: 
http://maps.dnr.state.mn.us/mapserver_demos/tests40/itemquery/test.html

To that effect, I've basically copied the tutorial and placed in my own 
customisations to make it work with my data.  So far I've not been terribly 
succesful and get the following error:

msQueryByAttributes(): Query error. No query expression defined.

There is most definitely a field called SITEID in the dbf file for the 
mergeplys layer.  There is also a record with a SITEID of 1003.

I am using mapserver 4.0 windows binary distribution.

The URL that gets generated looks like this:

http://192.168.0.3/cgi-bin/mapserv.exe?mapserv=f%3A%2Fprogram+files%2Fapache
+group%2Fapache2%2Fcgi-bin%2Fmapserv.exe&map=f%3A%2Fprogram+files%2Fapache+g
roup%2Fapache2%2Fhtdocs%2FKitasoo%2Fquerytest.map&map_web_imagepath=f%3A%2Fp
rogram+files%2Fapache+group%2Fapache2%2Ftmp&map_web_imageurl=%2Ftmp%2F&mode=
itemquery&qlayer=tuspoly&site_id=1003

I'm pretty sure I'm missing something basic somewhere.  One issue (I don't 
think this is what is causing the error message) is found in the template 
file.  I'm not quite sure what to do with some of the variables in this 
spot:

src="[mapserv]?map=[map]&name=[name_esc]&mode=itemquerymap&mapext=shapes&qla
yer=[qlayer]"
- I assume I need to change some of the values here.   Any advice or 
pointers to documentation greatly appreciated.

The mapfile I created looks like this:

MAP
  NAME case1
  SHAPEPATH tus
  SIZE 300 300
  EXTENT 768897.25886 810841.50306 876598.91242 913853.62854

  WEB
    IMAGEPATH 'f:/program files/apache group/apache2/htdocs/tmp/'
    IMAGEURL 'http://192.168.0.3/tmp/'
  END

  QUERYMAP
    STATUS ON
    STYLE HILITE
    COLOR 255 255 0
  END

  LAYER

    NAME "landpl"
    DATA "landpl"
    STATUS DEFAULT
    TYPE POLYGON
    CLASS
      COLOR 212 212 212
      OUTLINECOLOR 0 0 0
    END
  END

  LAYER
    NAME tuspoly
    DATA "mergeplys"
    STATUS ON
    TYPE POLYGON
    FILTERITEM SITEID
    FILTER "%site_id%"
    CLASS
	COLOR 160 160 255
    	OUTLINECOLOR 0 200 0
	TEMPLATE case1_template.html
    END
  END
END

My HTML file used to generate the URL should be attached (I hope!).

_________________________________________________________________
Add photos to your e-mail with MSN Premium. Get 2 months FREE*  
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=htt
p://hotmail.com/enca&HL=Market_MSNIS_Taglines



More information about the mapserver-users mailing list