Using GDALWARP to reproject raster that will fit with Google Satellite
Just a couple of notes to onself using gdal: Use gdalwarp to reproject your GeoTIFF files! I wanted to use my own satellite images acquired from GeoEye, however, on some areas I wanted to use google sat images as well since I don’t have the coverage. In order to do so, I need to reproject the sat images to 900913. Note you need to specify this in your epsg file in my previous post.
rupert:beijing_900913_satellite rupert$ gdalinfo Mosaic_RGB.tif Driver: GTiff/GeoTIFF Files: Mosaic_RGB.tif Size is 4248, 4553 Coordinate System is: GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.2572235630016, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",], UNIT["degree",0.0174532925199433], AUTHORITY["EPSG","4326"]] Origin = (116.291476140000000,40.025198500000002) Pixel Size = (0.000046860000000,-0.000035970000000) Metadata: AREA_OR_POINT=Area TIFFTAG_XRESOLUTION=100 TIFFTAG_YRESOLUTION=100 Image Structure Metadata: INTERLEAVE=BAND Corner Coordinates: Upper Left ( 116.2914761, 40.0251985) (116d17'29.31"E, 40d 1'30.71"N) Lower Left ( 116.2914761, 39.8614271) (116d17'29.31"E, 39d51'41.14"N) Upper Right ( 116.4905374, 40.0251985) (116d29'25.93"E, 40d 1'30.71"N) Lower Right ( 116.4905374, 39.8614271) (116d29'25.93"E, 39d51'41.14"N) Center ( 116.3910068, 39.9433128) (116d23'27.62"E, 39d56'35.93"N) Band 1 Block=4248x1 Type=Byte, ColorInterp=Red Band 2 Block=4248x1 Type=Byte, ColorInterp=Green Band 3 Block=4248x1 Type=Byte, ColorInterp=Blue |
rupert:beijing_900913_satellite rupert$ gdalwarp -s_srs epsg:4326 -t_srs epsg:900913 Mosaic_RGB.tif sat_4m_rgb.tif Creating output file that is 4245P x 4556L. Processing input file Mosaic_RGB.tif. ...10...20...30...40...50...60...70...80...90...100 - done. |
rupert:beijing_900913_satellite rupert$ gdalinfo sat_4m_rgb.tif Driver: GTiff/GeoTIFF Files: sat_4m_rgb.tif Size is 4245, 4556 Coordinate System is: PROJCS["Google Maps Global Mercator", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.2572235630016, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",], UNIT["degree",0.0174532925199433], AUTHORITY["EPSG","4326"]], PROJECTION["Mercator_1SP"], PARAMETER["central_meridian",], PARAMETER["scale_factor",1], PARAMETER["false_easting",], PARAMETER["false_northing",], UNIT["metre",1, AUTHORITY["EPSG","9001"]]] Origin = (12945507.907502911984921,4869604.732793668285012) Pixel Size = (5.219801430503303,-5.219801430503303) Metadata: AREA_OR_POINT=Area Image Structure Metadata: INTERLEAVE=PIXEL Corner Coordinates: Upper Left (12945507.908, 4869604.733) (116d17'29.31"E, 40d12'53.10"N) Lower Left (12945507.908, 4845823.317) (116d17'29.31"E, 40d 3'2.78"N) Upper Right (12967665.965, 4869604.733) (116d29'25.89"E, 40d12'53.10"N) Lower Right (12967665.965, 4845823.317) (116d29'25.89"E, 40d 3'2.78"N) Center (12956586.936, 4857714.025) (116d23'27.60"E, 40d 7'58.12"N) Band 1 Block=4245x1 Type=Byte, ColorInterp=Red Band 2 Block=4245x1 Type=Byte, ColorInterp=Green Band 3 Block=4245x1 Type=Byte, ColorInterp=Blue |