[Mapserver-west] Re: MapServer - Printing the Map and Legend

Ken Lord kenlord at gmail.com
Thu Jul 28 14:06:48 EDT 2005


Hi Dean,
  Thanks very much for your comment and interest. 
 I'm CC'ing this message to the MapServer-West list since I see you're from 
Vancouver too, and maybe others can benefit from the hints i'm sending you.
 My website has been around for awhile but only just recently was announced 
to the public by the mining company. Traffic on the site went from 5 or 10 
maps generated per day upto ~550 maps per day ... at least for the first 
couple days. Traffic is back down to normal now hehe.
 I'll send some code to you hopefully tonight, if not than in the next 
couple days (I'm at my day job right now, and might be going away this 
weekend).
 My website uses frames to help reduce one of the things that holds 
MapServer back ... on many sites you have to reload the full page instead of 
just the map when you zoom or pan. In using frames, the website has to pass 
the URL of the map frame around a lot. For example, the Layer control frame 
reads the URL of the map frame and adds / subtracts the names of layers to 
be turned on and off to the URL (and other details, like which element to 
display if the soil sample layer is on), and then redirects the map frame to 
the newly modified URL. Javascript and ASP work great for this, especially 
for turning groups of layers on/off at the same time.
 The Print page is similar, when you hit the print button, it opens the new 
window, and uses the URL of the map frame to setup the print page (modifying 
the HTML template to use the print template you see).
 The print page is just a normal html template, with a [legend] cgi 
parameter near the bottom, using a legend template that lays it out the way 
you've seen. I've been meaning to add a way to turn off the legend, say for 
if you're printing a few maps that are side by side that have the same 
legend.

Two things to beware of: 
 - The map resolution is only 72dpi. It doesnt look as nice on paper as it 
does on the screen. I've heard there may be a new way to use the RESOLUTION 
parameter that may help with this, haven't looked into this yet.
 - The scale of the map on paper is related to the 'dot pitch' of the 
monitor each user has ... the spacing of the pixels on the user's screen. 
I've used some javascript to adjust how the scale is listed on the printout 
using a 'typical' dot pitch value. Over time people will acquire better 
monitors with smaller dot pitches and for them, the scale will be less 
accurate ... to cover for these uncontrollable things, be sure to include a 
scale bar in your printout, even if the numerical scale is wrong, your users 
can always use the scale bar to measure distances properly.
 Cheers,
Ken
 On 7/27/05, Dean C. Mikkelsen <dcmikkelsen at shaw.ca> wrote: 
> 
> Hi Ken,
>  You've done some pretty amazing stuff with MapServer. I'm still learning.
>  I looked at the mining company site you developed. I really liked the 
> printing option to print the map and the legend information.
>  I was wondering if I may take a look at the code, as I would like to do 
> something similar with a project I am working on and it looks like it would 
> resolve a lot of my problems.
>  I look forward to hearing from you.
>  Kind regards,
> Dean
>  Dean C. Mikkelsen, B.Sc., P.Eng.
> Phone: 604-929-8630
> E-mail: dcmikkelsen at shaw.ca
>     
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/mapserver-west/attachments/20050728/8da45572/attachment.html


More information about the Mapserver-west mailing list