[Mapserver-users] Printing Template w/ MapServer

Delfos, Jacob jacob.delfos at maunsell.com
Thu May 20 20:27:10 PDT 2004


If you are using a popup window, use "window.opener". One tricky thing is
that usually your opener (main window) must have its name defined, which is
easy (window.name=...).

I created a pretty similar tool as what you are looking for. I have
converted it for use with Chameleon, but the principles are the same.

Your mapserver image in the main window must have its name defined. Then
from your popup you do something like:

popupimage.src opener.mapserverimage.src

Or 

Document.writeln("<IMG SRC='" + opener.mapserverimage.src + "'>"

To get your legend across, put your legend in a table, and apply the
innerhtml function to the cell of the table that holds your legend.

Regards,

Jacob






-----Original Message-----
From: Jerod Clabaugh [mailto:jclabaugh at mac.com] 
Sent: Friday, 21 May 2004 12:16 PM
To: mapserver-users at lists.gis.umn.edu
Subject: [Mapserver-users] Printing Template w/ MapServer


Hi:

I am trying to develop a template to allow the user to print the 
current view of a map, with the legend, all selected layers, scalebar 
etc.

I tried to mimic the print function from the MN DNR Recreational 
Compass site (http://www.dnr.state.mn.us/maps/compass.html) by 
picking through the source code 
(http://maps.dnr.state.mn.us/compass/view_print.html).

Does anyone know an easy way to pass the existing map, legend and 
scalebar from a mapserver page to another page without using a 
scripting language such as PHP.

I am passing this URL string:

<a 
href="[program]?map_reference_status=on&map=[map]&mapsize=500+500&template=/
Library/Apache2/htdocs/belize/print.html&mapext=[minx]+[miny]+[maxx]+[maxy]"

class="showline">Print Map View</a>

to the print.html page with the following code in it:

<img border="2" src="[img]">
<br /><br />
<img border="2" src="[legend]">
<br /><br />
<img src="[scalebar]"><br>
<p>
<b>Map Parameters</b> (UTM Zone 16, NAD27)</font><br>
  <i>minx:</i> [minx]<br />
<i>maxx:</i> [maxx]<br />
<i>miny:</i> [miny]<br />
<i>maxy:</i> [maxy]<br />
<img src="[ref]">

but only minx, miny, maxx, maxy are pass correctly to the print.html 
page ... the [img], [legend] and [scalebar] paths passed between the 
URL and the print.html page are absolute paths (i.e, map image is 
passed as /Library/Apache2/htdocs/tmp/BELIZE_0987765554.png (which 
Apache won't display) when I want it to just show 
/tmp/BELIZE_0987765554.png (which Apache would display).  I also 
tried passing [map_web_imageurl] but that produced the same result.

Any advice would be greatly appreciated,

Cheers,

Jerod Clabaugh


_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users



More information about the MapServer-users mailing list