0

GDAL2Tiles seems to crash after generating tiles and no google viewers are generated, but only openlayers.

This is the code I run:

os.system("gdal_translate -of VRT -a_srs EPSG:4326" + ground_control_points(input_file,Lon_max_min,Lat_max_min) + " " + input_file + " " + med_file)
os.system('gdalwarp -of VRT -t_srs EPSG:4326 ' + med_file + " " + output_file)
os.system('python "C:\Program Files\GDAL\gdal2tiles.py" -p geodetic -k -z "6-10" ' + output_file + " " + output_dir)

And what is printed in console:

Generating Base Tiles: 0...10...20...30...40...50...60...70...80...90...100 - done. Generating Overview Tiles: 0...10...20...30...40...50...60...70...80...90...100 - done.

And these are the files created in the output folder: enter image description here

If I run the following line, with verbose, this is what I get:

os.system('python "C:\Program Files\GDAL\gdal2tiles.py" -p geodetic -k -z "5" -v ' + output_file + " " + output_dir)

Verbose's output

Any hint?

1 Answer 1

1

When specifying the profile with the -p flag the only option that creates the google viewer (googlemaps.html) is the mercator option. The image below illustrates the resulting files and folders after running gdal2tiles 3 times on a small test image (image_4326.tif) by specifing -p mercator, -p geodetic and -p raster options respectively.

As in:

  1. python "C:\program Files\GDAL\gdal2tiles.py" -p mercator image_4326.tif tilesMercator
  2. python "C:\program Files\GDAL\gdal2tiles.py" -p geodetic image_4326.tif tilesGeodetic
  3. python "C:\program Files\GDAL\gdal2tiles.py" -p raster image_4326.tif tilesRaster

Side by side comparison of outputs from -p Option

I also experimented specifing the -w flag using "all" and "google" as viewer options but this still does not result in creating the google viewer file googlemaps.html when either -p geodetic or -p raster is used.

Summary: Change your -p option to mercator and the googlemaps.html file will be created.

Did some further testing and using -p geodetic and -z does not produce usable tiles. This has been discussed here as well: gdal2tiles generates small picture inside 256x256 tile

1
  • Thanks Rick for your detailed answer, however if I remove -p or select -all... the python execution still crashes. I'm pretty sure the problem is not related to the code but with the environment...
    – Rafa
    Commented May 4, 2015 at 8:28

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.