Small differences in input and output

Frank Warmerdam warmerdam at POBOX.COM
Thu Jun 14 11:07:03 EDT 2007


Ed McNierney wrote:
> Frank -
> 
> For MapServer EXTENT purposes Benoit will need to adjust the extents by one
> whole pixel rather than by half a pixel?  If there are N pixels horizontally
> measured from the center of the left-hand to the center of the right-hand
> pixel, then there are N+1 pixels measured from the left of the left-hand to
> the right of the right-hand pixel, rather than N+0.5.
> 
> That is, if you adjust all four corners "in" by 0.5 pixel you'll reduce the
> height and width by 1 whole pixel each.

Ed,

If the original file is 100 x 100 (for instance) with gdal reported extents
of (0,0) to (1000,1000) then the mapfile should contain:

  EXTENT 5 5 995 995
  SIZE 100 100

So the size is determined by the SIZE keyword - not the extents.

Note that mapserver macros like MS_CELLSIZE already account for the fact
that the extents represent a region that is in a sense n-1 pixels wide/long.

eg.

#define MS_CELLSIZE(min,max,d)    ((max - min)/(d-1))

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list