[mapserver-users] Points with hyperlinks

Steve Lime Steve.Lime at dnr.state.mn.us
Thu Sep 25 11:54:22 EDT 2008


One option is to trigger MapServer queries on each click. How you do that depends on your
client environment. For example, on this site:

  http://www.dnr.state.mn.us/maps/compass.html 

OpenLayers is used for the client. When a click is detected a MapServer query url is built and
opened in a new window. With some feature types (for example, state parks) I the info needed
to build a URL to another page on our site in the attribute table. I use those and a URL query
template to redirect the browser to the appropriate page. For example:

  LAYER
    NAME 'state_parks'
    ...
    TEMPLATE 'http://www.dnr.state.mn.us/state_parks/[PARK_DIR]/index.html'
  END

Works great. You can't use a full URL (including the http://) in an attribute like this since MapServer
needs to somehow tell the difference between a URL-based template and a file-based on. It's
perfectly acceptable though to do something like:

  TEMPLATE 'http://[ATTRIBUTE]'

Steve

>>> On 9/25/2008 at 7:00 AM, in message <4A00AA82216644238C935DDBAE56175A at Leeml>,
"Matej" <matej at matnet.net> wrote:
> Hi,
> 
> I have a mapfile with layer that has a large number of points on it. Every 
> point (well, many of them) has an attribute "hyperlink". What would be the 
> easiest way to achieve a "clickable" point and get that URL in a new window?
> 
> Matej Serc
> matej at matnet.net



More information about the mapserver-users mailing list