I have a map portion PNG and its associated PRJ file. I want to convert the PNG to a GeoTIFF.
I know how to convert a PNG to a GeoTiff if the bounding box is available:
gdal_translate -of Gtiff -a_ullr LEFT_LON UPPER_LAT RIGHT_LON LOWER_LAT -a_srs EPSG_PROJ INPUT_PNG_FILE OUTPUT_GTIFF_FILE.
But in this case, I don't have bounding box lat lons specifically. How do I proceed?
My PNG is: NA 10H-N.png and Its gdalinfo says:
Driver: PNG/Portable Network Graphics
Files: NA 10H-N.png
Size is 11575, 4961
Coordinate System is `'
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 4961.0)
Upper Right (11575.0, 0.0)
Lower Right (11575.0, 4961.0)
Center ( 5787.5, 2480.5)
Band 1 Block=11575x1 Type=Byte, ColorInterp=Palette
Color Table (RGB with 18 entries...
The associated PRJ file reads;
PROJCS["PROJ",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY["EPSG","4326"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",45],PARAMETER["standard_parallel_2",30],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-80],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1]]
Answer
If you don't know the extent in coordinates of the prj file, you have to georeference the file manually using ground control points. This is rather comfortable if you have QGIS installed, and you can guess some details from the image.
In some cases, you can build the extent manually if the filename follows a certain rule, like the one-degree-SRTM files do.
Or the file covers the whole world, but that would require a certain size ratio, like 2:1 for WGS84. With LCC projection this is not possible.
By the way: You will have to expand your paletted colours to RGB or RGBA using -expand rgb
. A projected palette will look very weird, because GDAL will try to interpolate the palette values.
No comments:
Post a Comment