determining aspect ratio and output map extents

Brent Fraser bfraser at GEOANALYTIC.COM
Thu Oct 18 15:17:52 EDT 2007


Nate,

  You  could ask mapserver (or shp2img) to generate GeoTIFFs
as output:

OUTPUTFORMAT
  NAME GTiff
  DRIVER "GDAL/GTiff"
  MIMETYPE "image/tiff"
  IMAGEMODE RGB
  EXTENSION "tif"
END

The GeoTIFFs would have georeferencing information in it,
and a utility such as gdalinfo (or the appropriate function
in the gdal library) would give the extents of the image.

    Since mapserver was designed to serve maps on the web,
the image SIZE was considered to be the most important
factor (and the extents were adjusted to fit, along with a
potential small adjustment of the scale).  It would be a
nice enhancement to shp2imge to accept a -SCALE option
(or -PIXELSIZE?) and have it automatically calculate the
image size required.

    For now, you could calculate the size in your favorite
scripting langauge, and based on your desired extent and
scale, create a temporary mapfile for that output image.  Or
use mapserv with the SIZE parameter set in the QUERY_STRING,
or use mapscript...

Brent Fraser
GeoAnalytic Inc.
Calgary, Alberta

----- Original Message ----- 
From: "Nathan Vander Wilt"
<nathan.vanderwilt at ORIONNETWORKSOLUTIONS.COM>
To: <MAPSERVER-USERS at LISTS.UMN.EDU>
Sent: Thursday, October 18, 2007 10:57 AM
Subject: [UMN_MAPSERVER-USERS] determining aspect ratio and
output map extents


> We are hoping to use MapServer to automate the
rasterization of a
> whole stack of layers. We previously did this using
ArcMap's image
> export, and although the process was fraught with peril,
the program
> did allow us to export a world file giving the extent of
the exported
> images, which we rely on in a later part of our process.
>
> We've noted that the EXTENT set in the map file does not
always match
> the output, because the output image extents also depend
on the
> aspect ratio of the given SIZE.
>
> Do the MapServer tools provide any method to determine an
optimal
> aspect ratio for the SIZE so that the EXTENT set in the
map file will
> match the extent of the output image after rendering?
>
> And/or: Is there a way to query the coordinates of the
output corners
> from a .map file, either via shp2img, the CGI or some
other utility?
>
> thanks,
> -natevw



More information about the mapserver-users mailing list