Saturday 22 April 2017

gdal2tiles.py gives ERROR 6 about EPSG:900913 on fresh Ubuntu 14.04 install


I have a fresh install of Ubuntu 14.04. I installed gdal with sudo apt-get install gdal-bin python-gdal. After this I have: GDAL 1.10.1 released 2013/08/26.


I am trying to tile the weather radar images from NOAA. The following are my steps and the error message that is displayed.


$wget http://radar.weather.gov/ridge/Conus/RadarImg/latest_radaronly.gif
$wget http://radar.weather.gov/ridge/Conus/RadarImg/latest_radaronly.gfw

$gdal_translate -of vrt -expand rgba ./latest_radaronly.gif temp.vrt
$cp ./latest_radaronly.gfw ./temp.wld
$gdal2tiles.py -s EPSG:3857 -w none -r near -z 3-5 -n ./temp.vrt ./temp/

The errors shown are then:


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.
ERROR 6: No translation for an empty SRS to PROJ.4 format is known.
Generating Base Tiles:

ERROR 5: Illegal values for buffer size
ERROR 5: Illegal values for buffer size

From that error, it seems that there is a problem with the EPSG:900913 (google) format. That is why I specifically set -s EPSG:3857.


All of this should work. I did the steps above from scratch, because I have an older server (ubuntu 12.04) where I am currently doing this without error. Once I upgrade to 14.04 the error above shows up. I am trying find the reason for the error. A google search for the the error message results in some old email list traffic that were either not about ubuntu or had other issues.


As a side note, I also tried building from source and there was no change in the errors displayed.



Answer



Going from what @user30184 said in the comment.


This issue is that the gdal2tiles.py script tells gdal to output 'mercator' as EPSG:900913. This is fine as long as it knows how to convert to this.


The fix is to change the following line in gdal2tile.py (line 785):



if self.options.profile == 'mercator':
self.out_srs.ImportFromEPSG(900913)

to:


if self.options.profile == 'mercator':
self.out_srs.ImportFromEPSG(3857)

This one change allows gdal2tiles.py to run without error.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...