Inline features

Stephen Lime steve.lime at dnr.state.mn.us
Thu Mar 16 12:51:00 PST 2000


Doing this is a little tricky but not too bad. The input page is straight forward, just a
normal MapServer type form. The key is how you process the request. 

In the mapfile you'll want to set the overall map status to OFF, this just tells the MapServer to process
the request but not to actually make the map gif. The map will get created in a second "mode=map"
request.

You'll also want to create a layer definition for the users point. It should have no DATA element but
should set up the correct symbol and fonting you want. It's status should be OFF. Lets assume you 
call the layer 'user'.

Now, normally in a MapServer template file you have a line that looks like:

<input type="image" name="img" src="[img]">

in this case you want to replace [img] with (assuming a layer called user):

/cgi-bin/mapserv?map=[map]&mode=map&map_user_feature=new&map_user_feature_points=[mapx]+[mapy]
&map_user_feature_text=[label]&layer=users&mapext=[minx]+[miny]+[maxx]+[maxy]

The rest of the template is as normal. In this case [mapx] and [mapy] are the coordinates of the users click.
[label] takes the value typed in by the user in the previous form assuming the name of that text box was
'label'. The nice thing about this approach is that since no has to be created initially the template loads
very quickly, then the browser fetches the map. The DNR Compass uses this technique. (see 
http://www.dnr.state.mn.us/compass/)

Clear as mud?

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> RAldridge <RAldridge at linuxstart.com> 03/16/00 01:44PM >>>
Could someone provide an example of using inline features with MapServer.  I'm having a problem figuring it out.  What I'd like to do is have the user input a desired label in a form, click the map, and the map redraw with a marker & label at the clicked point.  Any examples out there?

Thanks

Robert Aldridge
----------------------
Do you do Linux? :) 
Get your FREE @linuxstart.com email address at: http://www.linuxstart.com




More information about the MapServer-users mailing list