gdal2tiles Error

746 views
Skip to first unread message

nusaif

unread,
Dec 7, 2008, 1:05:48 PM12/7/08
to MapTiler User Group
Hi, I am following the steps on the "beta test" page

but i am facing a problem when running this command.

" gdal2tiles c:\g.tif "

Usage: gdal2tiles.py [options] input_file(s) [output]

gdal2tiles.py: error: There is no georeference - neither affine
transformation (worldfile) nor GCPs. You can generate only 'raster'
profile tiles.

Either gdal2tiles with parameter -p 'raster' or use another GIS
software for georeference e.g. gdal_transform -gcp / -a_ullr / -a_srs

However, it does execute when running " gdal2tiles -p raster c:\g.tif
"
but I need the mercator projection to use the tiles on google maps.

also , when trying to specify the zoom level it produces another
error:

" gdal2tiles -p raster -z 7 c:\g.tif "

Traceback (most recent call last):
File "C:\TILING\apps\gdal-dev\bin\gdal2tiles.py", line 2087, in
<module>
gdal2tiles.process()
File "C:\TILING\apps\gdal-dev\bin\gdal2tiles.py", line 462, in process
self.open_input()
File "C:\TILING\apps\gdal-dev\bin\gdal2tiles.py", line 925, in
open_input
self.tminmax = range(0, self.tmaxz+1)
TypeError: cannot concatenate 'str' and 'int' objects

any suggestion ?


Klokan Petr Přidal

unread,
Dec 7, 2008, 3:36:48 PM12/7/08
to mapt...@googlegroups.com
Hi,

> gdal2tiles.py: error: There is no georeference - neither affine
> transformation (worldfile) nor GCPs. You can generate only 'raster'
> profile tiles.

You need to provide correct georeference for your image. The utility
must know the geographic location of your tif file, otherwise it is
only a picture and not a map!

Use some GIS software to georeference the image, GDAL2Tiles is able to
read such georeference (world file for example).

You can also generate WorldFile by hand for your tif file. It should
have a name .tfw and the format is described on several places online.
You would have to specify what coordinate system are you using on the
command line (it will be probably "--s_srs EPSG:4326" for latitude and
longitude in WGS84 datum).

Alternatively you can specify ground control points into the utility
gdal_translate as it is suggested, such step by step example is here:
http://blog.thematicmapping.org/2008/03/generating-map-tiles-with-gdal2tiles.html,
but it can be done more effectively and some steps are not necessary
anymore... anyway...

In case you need to generate tiles from a file without georeference
and you are not familiar with GIS tools you can also try MSR
MapCruncher, but it generates viewer for Microsoft Virtual Earth only.
The tiles are later on usable in Google Maps as well, but you have to
code a bit in JavaScript.

> also , when trying to specify the zoom level it produces another

> " gdal2tiles -p raster -z 7 c:\g.tif "

> TypeError: cannot concatenate 'str' and 'int' objects

The correct format is "-z 1-7" for example, but I repaired this error
message, it will appear in the new version of GDAL2Tiles. Thanks for
the bug-report.

Klokan Petr Pridal

Reply all
Reply to author
Forward
0 new messages