Differences
This shows you the differences between two versions of the page.
docs:gis:projections:assigning_a_projection_to_a_raster_file [2007/04/19 17:40] – created billh | docs: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 [[: | ||
+ | - 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:< | ||
+ | Location: 15 to 60 degrees North latitude, 50 to 130 degrees West longitude | ||
+ | Orientation: | ||
+ | Image Data: shaded and colored SRTM elevation model | ||
+ | Original Data Resolution: SRTM 1 arcsecond (about 30 meters or 98 feet) | ||
+ | Date Acquired: February 2000 | ||
+ | </ | ||
+ | |||
+ | * command used to determine mercator projection data: | ||
+ | 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 | ||
+ | 3537017.77 | ||
+ | </ | ||
+ | |||
+ | * 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):< | ||
+ | |||
+ | scale: | ||
+ | (3537017.77 x 2) / 9600 = 736.8787021 | ||
+ | |||
+ | world file contents: | ||
+ | 736.8787021 | ||
+ | 0 | ||
+ | 0 | ||
+ | -736.8787021 | ||
+ | -3537017.77 | ||
+ | 6642819.94 | ||
+ | </ | ||
+ | |||
+ | * we also knew how to adjust the projection in mapserver:< | ||
+ | ... | ||
+ | EXTENT -3537017.77 1333018.49 3537017.77 6642819.94 | ||
+ | ... | ||
+ | PROJECTION | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | END | ||
+ | ... | ||
+ | </ |