docs:gis:projections:assigning_a_projection_to_a_raster_file

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

docs:gis:projections:assigning_a_projection_to_a_raster_file [2007/04/19 17:40] – created billhdocs:gis:projections:assigning_a_projection_to_a_raster_file [2008/08/03 00:25] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Assigning a Projection to a Raster File ======
 +  - gather any information about the raster file, such as the extents of the image, the projection used, etc...
 +  - create a [[:docs:gis:world_files|world file]] (sidecar file) for the image
 +  - you may now use the image with the world file if you want to input the projection every time, or you can use gdalwarp to create a new file with the projection information included
  
 +===== Tips =====
 +  * use the cs2cs command to convert known extend coordinates
 +
 +===== Example =====
 +For a given raster image, we knew the limits of the latitude and longitude, and that the file was using Mercator projection
 +  * we were given:<code>
 +    Location: 15 to 60 degrees North latitude, 50 to 130 degrees West longitude
 +    Orientation: North toward the top, Mercator projection
 +    Image Data: shaded and colored SRTM elevation model
 +    Original Data Resolution: SRTM 1 arcsecond (about 30 meters or 98 feet)
 +    Date Acquired: February 2000 
 +</code>
 +
 +  * command used to determine mercator projection data:(numbers are x y as in long lat, unless option flags are used)<code>
 +cs2cs +proj=latlong +ellps=WGS84 +to +proj=merc +ellps=WGS84 +lat_ts=37.5 +lon_0=-90 <<EOF
 +> -130 15
 +> -50 60
 +> EOF
 +
 +Output:
 +-3537017.77     1333018.49 0.00
 +3537017.77      6642819.94 0.00
 +</code>
 +
 +  * with this output and determining the resolution of the raster file at 9600 x 7240, we knew how to create an appropriate world file (coordinates are based on top left of image):<code>
 +
 +scale:
 +(3537017.77 x 2) / 9600 = 736.8787021
 +
 +world file contents:
 +736.8787021
 +0
 +0
 +-736.8787021
 +-3537017.77
 +6642819.94
 +</code>
 +
 +  * we also knew how to adjust the projection in mapserver:<code>
 +...
 + EXTENT -3537017.77 1333018.49 3537017.77 6642819.94
 +...
 + PROJECTION
 + "proj=merc"
 + "ellps=WGS84"
 + "lat_ts=37.5"
 + "lon_0=-90"
 + END
 +...
 +</code>