Closed alanlun516 closed 6 years ago
Hey @alanlun516,
I think we may need a bit more information here to figure out what's going on. I've been able to convert a png to mbtiles using the latest version of gdal2mbtiles (2.1.1), so it doesn't seem to be an issue for all PNG files.
Is your PNG georeferenced? Could you paste the output of gdalinfo test.png
? And what version of gdal2mbtiles are you running?
Hello,
I am using
Linux Mint 18.1
Python 3.6.5
pip 9.0.3
gdal2mbtiles 2.1.0
The requested gdalinfo output
$ gdalinfo test.png
Driver: PNG/Portable Network Graphics
Files: test.png
Size is 2048, 1536
Coordinate System is `'
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 1536.0)
Upper Right ( 2048.0, 0.0)
Lower Right ( 2048.0, 1536.0)
Center ( 1024.0, 768.0)
Band 1 Block=2048x1 Type=Byte, ColorInterp=Red
Mask Flags: PER_DATASET ALPHA
Band 2 Block=2048x1 Type=Byte, ColorInterp=Green
Mask Flags: PER_DATASET ALPHA
Band 3 Block=2048x1 Type=Byte, ColorInterp=Blue
Mask Flags: PER_DATASET ALPHA
Band 4 Block=2048x1 Type=Byte, ColorInterp=Alpha
Thanks, Alan
Thanks for the info @alanlun516!
Unless there's a copy/paste error there, it seems like your PNG is missing some projection and datum information about the coordinate system? So I think the issue may be with your input file, since GDAL can't read the coordinate system info (and thus gdal2mbtiles' SpatialReference
can't read the EPSG code)
Hi @mghughes,
It is not an error, sorry that I misused the program. I think the issue is not valid. I would like to suggest a warning about coordinate system information missing. Thanks a lots @mghughes.
Best, Alan
Hello again~ Error occurs when converting PNG to MBTiles (whenever calling
_osr.SpatialReference_ImportFromEPS
actually).I tried to show what "code" was and therefore added
print("code: {}, type(code): {}".format(code, type(code)))
to line 799 in gdal.py.Therefore I tried to give a
--spatial-reference 4326
, it shows the following.Seems that it always fails in the third round. Please help.