Query template file question

kenboss at dilbert.dnr.state.mn.us kenboss at dilbert.dnr.state.mn.us
Fri Oct 29 11:31:04 EDT 1999


Jim--

If I'm understanding your question correctly, all you need to do is to put the URL in quotes after the 
"template" keyword in the query block in your map file.  So, instead of something like this:

LAYER
  ...
  ...
  QUERY
    TEMPLATE "http://www.dnr.state.mn.us/someapp/somefile.html"
  END
END


You have something like this:

LAYER
  ...
  ...
  QUERY
    TEMPLATE "http://www.dnr.state.mn.us/perl/lk_search.pl?var1=[SOMEFIELD]&var2=[ANOTHER_FIELD]"
  END
END


Where [SOMEFIELD] and [ANOTHER_FIELD] are attributes of the shape that the user clicked on (eg., the 
unique id you want to pass to your PHP3 script).

This can have all sorts of cool applications, for example, we use:

LAYER
  NAME counties
  TYPE polyline
  STATUS default
  DATA counties
  CLASS
    NAME "County Boundaries"
    SYMBOL 1
    SIZE 1
    COLOR 0 0 0
  END
  QUERY
    TEMPLATE "http://www.ra.dnr.state.mn.us/cgi-bin/mapserv3.2?map=photos/etc/photos.map&mapext=[shpext]"
  END
END # Layer counties


to allow users to zoom in to the extent of a county from an initial statewide interface (see 
http://www.ra.dnr.state.mn.us/photos/photos_init.html).  Note that in this case [shpext] is not an 
attribute of the shape per se (that is, it's not stored in the .dbf file), but is a value calculated by 
the mapserver software (documented at http://mapserver.gis.umn.edu/templates.html).

Hope this helps,

--Ken


============================================================================
Ken Boss                                
Digital Image Analysis / Web Stuff      Forestry Resource Assessment
kenboss at dilbert.dnr.state.mn.us         Minnesota Dept. of Natural Resources
Voice: 218 327 4449 ext. 237            413 SE 13th Street                    
Fax:   218 327 4517                     Grand Rapids, MN  55744         USA
============================================================================





More information about the mapserver-users mailing list