Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: in method 'SpatialReference_ImportFromEPSG', argument 2 of type 'int' #37

Open
nevilamos opened this issue May 7, 2020 · 1 comment

Comments

@nevilamos
Copy link

I note this issue has already been raise at : #22 however in that case it was for a ,png with no projection data/EPSG number embedded.
I am encountering the same error trying to run on a geotiff which gdal info shows has spatial referencing:

my command is:
gdal2mbtiles -v masked.tif masked.mbtiles --min-resolution=7 --max-resolution=8

Traceback (most recent call last):
File "/home/nev/.local/bin/gdal2mbtiles", line 11, in
load_entry_point('gdal2mbtiles==2.1.2', 'console_scripts', 'gdal2mbtiles')()
File "/home/nev/.local/lib/python2.7/site-packages/gdal2mbtiles/main.py", line 309, in main
colors=colors, band=band)
File "/home/nev/.local/lib/python2.7/site-packages/gdal2mbtiles/helpers.py", line 194, in warp_mbtiles
validate_resolutions(resolution=dataset.GetNativeResolution(),
File "/home/nev/.local/lib/python2.7/site-packages/gdal2mbtiles/gdal.py", line 497, in GetNativeResolution
dst_ref = self.GetSpatialReference()
File "/home/nev/.local/lib/python2.7/site-packages/gdal2mbtiles/gdal.py", line 463, in GetSpatialReference
sr = sr.FromEPSG(sr.GetEPSGCode())
File "/home/nev/.local/lib/python2.7/site-packages/gdal2mbtiles/gdal.py", line 799, in FromEPSG
s.ImportFromEPSG(code)
File "/usr/lib/python2.7/dist-packages/osgeo/osr.py", line 797, in ImportFromEPSG
return _osr.SpatialReference_ImportFromEPSG(self, *args)
TypeError: in method 'SpatialReference_ImportFromEPSG', argument 2 of type 'int'

the gdalinfo on the file returns:
Driver: GTiff/GeoTIFF
Files: masked.tif
Size is 3620, 2530
Coordinate System is:
PROJCS["unnamed",
GEOGCS["unnamed ellipse",
DATUM["unknown",
SPHEROID["unnamed",6378137,0]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Mercator_2SP"],
PARAMETER["standard_parallel_1",0],
PARAMETER["central_meridian",0],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]]]
Origin = (15660855.904725419357419,-4021344.132019802927971)
Pixel Size = (289.432029319978540,-286.592914214417760)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left (15660855.905,-4021344.132) (140d41' 1.90"E, 33d56'39.98"S)
Lower Left (15660855.905,-4746424.205) (140d41' 1.90"E, 39d10'21.33"S)
Upper Right (16708599.851,-4021344.132) (150d 5'45.26"E, 33d56'39.98"S)
Lower Right (16708599.851,-4746424.205) (150d 5'45.26"E, 39d10'21.33"S)
Center (16184727.878,-4383884.169) (145d23'23.58"E, 36d36'10.04"S)
Band 1 Block=3620x1 Type=Byte, ColorInterp=Red
Band 2 Block=3620x1 Type=Byte, ColorInterp=Green
Band 3 Block=3620x1 Type=Byte, ColorInterp=Blue

@elfmanryan
Copy link

Hi sorry your having trouble, ad sorry for the delayed reply, issues on this repo have slipped past us.
I dont think your geotiff does have a geometry. I notice:
PROJCS["unnamed", GEOGCS["unnamed ellipse", DATUM["unknown",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants