Change image resolution in mapfile

Norman Vine nhv at CAPE.COM
Wed Jan 25 13:14:32 PST 2006


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