4

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]]
  • Can you show us the image and tell the story of where it's from? I wrote this to R-Sig-Geo the other day for a similar problem: stat.ethz.ch/pipermail/r-sig-geo/2014-October/021814.html. Someone with the experience can help, but you'll need more information about where the image comes from and probably ultimately what it looks like. – mdsumner Oct 14 '14 at 10:15
  • what if the prj file also contains the bounding box? How would you convert that? Thank you so much. – Dakatine Sep 22 '15 at 16:53
4

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.

  • That's right, it is necessary to expand paletted colours. Self Geo-referencing the imagery is not a viable option. I posted this to see if it is possible to do the conversion with what is available. I am right now checking if the file name 10H-N represents a standard region under any convention that translates to a fixed bounding box. – Kartins Oct 15 '14 at 6:20
0

This site converts png to geotiff quite well : https://mygeodata.cloud/converter/png-to-gtiff

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.