1

I'm trying to overlay satellite images in a web page, images are properly georeferenced.

Example of image

When I use gdal2tiles by default it throws an error:

gdal2tiles.py --zoom 0-5 --s_srs EPSG:4326 20173481715B02G16.tif dist/

ERROR 6: EPSG PCS/GCS code 900913 not found in EPSG support files.  Is this a valid
EPSG coordinate system?
ERROR 6: No translation for an empty SRS to PROJ.4 format is known.
Traceback (most recent call last):
  File "/usr/bin/gdal2tiles.py", line 2278, in <module>
    gdal2tiles.process()
  File "/usr/bin/gdal2tiles.py", line 482, in process
    self.open_input()
  File "/usr/bin/gdal2tiles.py", line 856, in open_input
    self.out_ds.SetMetadataItem('NODATA_VALUES','%i %i %i' % (self.in_nodata[0],self.in_nodata[1],self.in_nodata[2]))
IndexError: list index out of range

However if I use a profile such as raster or geodetic it works fine but when I overlay that layer over an OpenStreetMap layer, using leaflets or openlayers the result its a mess, the layer goes to Antarctica.

gdal2tiles.py --zoom 0-5 --profile geodetic --no-kml 20173481715B02G16.tif dist/
gdal2tiles.py --zoom 0-5 --profile raster --no-kml 20173481715B02G16.tif dist/

Image not working

This example it's using the raster profile, with geodetic the result it's pretty similar.

I did try to force projection with --s_srs EPSG:4326 parameter, change the projection in openlayers but nothing seams to work.

What am I doing wrong or how can I fix this?

4
  • What is your GDAL version from gdalinfo --version?
    – user30184
    Feb 16, 2018 at 13:24
  • 1
    You can also have a try with just a current version of gdal2tiles.py trac.osgeo.org/gdal/browser/trunk/gdal/swig/python/scripts/… that is using the correct EPSG:3857 code for Web Mercator.
    – user30184
    Feb 16, 2018 at 13:35
  • this is the version GDAL 1.11.3, released 2015/09/16 The tiff image is in EPSG:4326 GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433], AUTHORITY["EPSG","4326"]]
    – engel
    Feb 16, 2018 at 13:45
  • The reported error is "PCS/GCS code 900913 not found in EPSG support files". Use newer script that does not use that fake code.
    – user30184
    Feb 16, 2018 at 13:54

1 Answer 1

2

Turns out that I was using and old version of the script. With the new version all problems are gone.

Thanks @user30184.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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