Change image resolution in mapfile

Ed McNierney ed at TOPOZONE.COM
Wed Jan 25 16:34:11 EST 2006


Norman -

Well, you can increase that limit and recompile, too!

But this is a valid concern because many output formats have a
"resolution" value/tag embedded in them.  If you create a "300DPI" image
and the TIFF or JPEG is set to 72 DPI, your users will (a) think the
image is too large and/or (b) think they get a "low resolution" image
instead of a "good one" (been there, done that <g>).

	- Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242 

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Norman Vine
Sent: Wednesday, January 25, 2006 4:15 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] Change image resolution in mapfile

David Bitner writes:

> All you need to do to spit out the image is to ask for how many pixels

> wide by how many pixels tall you want the image, so if you want a 
> 36"x24" poster, you will want to use  300*36 x
> 300*24  as your width and height.  From there it's just monkeying 
> around to get the symbols to come out the size you want.


Except that mapserver has a hardwired maximum image size 

IIRC this is 2048 x 2048 pixels.  
see  map.h  MS_MAXIMAGESIZE_DEFAULT
 
So you will need to build the image up in tiles then stitch them
together with something like imagemagick

shp2img can be used to do this using something like this untested pseudo
code

pixels_y = DPI * POSTER_Y
pixels_x = DPI * POSTER_X

tiles_y  = pixels_y / TILE_SIZE
tiles_x = pixels_x / TILE_SIZE

map_width = map_max_x - map_min_x
map_height = map_max_y - map_min_y

tile_width = map_width / tiles_x
tile_height = map_height / tiles_y

y = 0
tile_min_y = map_min_y

for y < tiles_y:
   x = 0
   tile_max_y =  tile_min_y + tile_height
   tile_min_x = map_min_x
   for x < tiles_x:
     tile_name = poster_name_ + str(y) + "_" + str(x) + "." +
$FORMAT_EXT
     tile_max_x = tile_min_x + tile_width
     system( "shp2img -m MAPFILE -e tile_min_x tile_min_y tile_max_x
tile_max_y -o tile_name")
     tile_min_x = tile_max_x
     end
   tile_min_y = tile_max_y
   end

HTH

Norman   

 
> On 1/25/06, krishna S <kris_rock82 at yahoo.com> wrote:
> > Hello all,
> >       I have to generate a 300 by 300 dpi wall map to print, I was 
> > wondering how can we generate the map using mapserver, i know that 
> > usually when the image is generated it gets saved in 72dpi. I am not

> > displaying the map in thw browser but i just want to generate the 
> > map so that i can print it out.
> >
> >       I searched the archives about this but couldnt find how to 
> > generate it actually.
> >
> > Any suggestions please .....
> >
> > --kris
> >
> 



More information about the mapserver-users mailing list