====== 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: 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 * command used to determine mercator projection data:(numbers are x y as in long lat, unless option flags are used) cs2cs +proj=latlong +ellps=WGS84 +to +proj=merc +ellps=WGS84 +lat_ts=37.5 +lon_0=-90 < -130 15 > -50 60 > EOF Output: -3537017.77 1333018.49 0.00 3537017.77 6642819.94 0.00 * 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 "proj=merc" "ellps=WGS84" "lat_ts=37.5" "lon_0=-90" END ...