# Raster layer - Howto?

Thu Nov 1 11:10:34 EDT 2007

```Hi Brent!

Thank you so much for your effort, I definitely owe you a drink!
This is a really cool overview of world files and mapping stuff at all!

Greetings,
Pascal

Brent Fraser wrote:

> Pascal,
>
>   I would guess the data is in a geographic coordinate
> system.  This means the units of coordinates and pixel sizes
> for the image would be degrees not meters.  I would also
> assume that the image covers the entire Earth, not just a
> part of it, so:
>
> Calculating the X (longitude) pixel size, 360 degrees covers
> the Earth all the way around:
> 360 degrees / 8192 pixels = 0.0439453125 degrees per pixel
> in X
>
> Calculating the Y (latitude) pixel size, 180 degrees covers
> the Earth pole to pole:
> 180 degrees / 4096 pixels = 0.0439453125 degrees per pixel
> in Y
>
> Notice the pixel size in X is the same as Y.  This is
> typical for a raster map (but not a hard rule).
>
> ---------------
> And now for a reality check.  Approximately how many
> meters-on-the-ground is each pixel?
> 0.0439453125 degrees/pixel  * 60 minutes/degree * 60
> seconds/minute * 30 meters/second (approx) = 4700
> meters/pixel
> Interesting information, but not needed for the tfw file.
> ---------------
>
> So back to the calculations for the tfw file:
>
> The coordinates of the upper-left corner of the upper left
> pixel would be
> X = -180 degrees
> Y = 90 degrees
>
> But the tfw file specifies the MIDDLE of the upper left
> pixel (so we need to subtract half a pixel width from each
> coordinate):
> X = -180 + 0.0439453125/2 = -179.97802734375
> Y =   90 - 0.0439453125/2 =   89.97802734375
>
> So the tfw file would be:
>
> 0.0439453125
> 0
> 0
> -0.0439453125
> -179.97802734375
> 89.97802734375
>
>
> One more step for Mapserver:
>
> Since the tiff file is not a geotiff, you need to tell
> mapserver the coordinate system of the raster file.  So your
> layer definition in the the map file would be (note the
> PROJECTION object):
>
> ########## NASA BLUE MARBLE ###########
>    LAYER
>      NAME "satellite"
>      DATA "/var/www/odamap/blue_marble.tif"
>      TYPE RASTER
>      PROJECTION
>        "geographic"
>      END
>