15 votes
Accepted

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

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. ...
user avatar
  • 418
7 votes
Accepted

How to use gdal2tiles on a custom tiff image recieved from providers to generate tiles

I think all you need to do is reproject it using: gdalwarp -co TILED=YES -co COMPRESS=DEFLATE -t_srs EPSG:3857 image.tif newImage.tif and then tile it: gdal2tiles.py newImage.tif If your file is ...
user avatar
  • 74.6k
6 votes

gdal2tiles generates small picture inside 256x256 tile

I'm not sure why, but gdal2tiles does not seem to like a combination of -z and -p raster. So I used call gdal2tiles.bat -p raster ibcso_background_hq.tif and got the right picture in all zoom levels:...
user avatar
  • 74.9k
6 votes

Implementing OpenLayers3 basemap from tiles created using gdal2tiles

The main point is that by default OpenLayers 3 follows the widely-used Google grid where x 0 and y 0 are in the top left. Grids like TMS where x 0 and y 0 are in the bottom left can be used by using ...
user avatar
  • 191
6 votes
Accepted

Getting the same result from "Generate XYZ Tiles" and "Gdal2Tiles" in QGIS

By default, "Generate XYZ Tiles (Directory)" uses XYZ tile scheme whereas "gdal2Tiles" uses TMS tile scheme. The difference is XYZ convention starts tile numbering with coordinates ...
user avatar
  • 28.6k
5 votes

How to publish generated tiles to web?

When you run gdal2tiles command, three extra (html) files along with an xml file are created. These html files are sufficient to view these tiles in browser of system connected to internet. These ...
user avatar
5 votes
Accepted

Displaying tiles generated by gdal2tiles with OpenLayers?

You should simply change your url to: url: './data/maps/7068/temp/{z}/{x}/{-y}.png', Why? Because XYZ tiling scheme differs from TMS scheme (produced by gdal2tiles) for tiles. It's because Y ...
user avatar
  • 28.6k
4 votes

OSGeo4W and GDAL - gdal2tiles.py error

This same error threw me off, too. Adding NODATA transparency value parameter to the call fixed it for me, so instead of gdal2tiles.py -z 1-10 ~/hfp_wgs/hdr.adf hpf-tiles I called gdal2tiles.py -z ...
user avatar
  • 181
4 votes
Accepted

How do I convince gdal2tiles to output pngs with transparency?

What finally worked for @RobotCaleb was the following: Apply mask to alpha (band 4): gdal_translate -mask 4 stadium3857.tif stadium3857_RGB.tif 2. Compute a new alpha channel from NoData values: ...
user avatar
  • 543
4 votes

gdal2tiles in FWTools Shell

It's simply because FWTools is so old that it does not use osgeo Python namespace as illustrated at the bottom of the GDAL Python section about import You should install GDAL via OSGEO4W or GIS ...
user avatar
  • 28.6k
4 votes

OSGeo4W (gdal 2.1.0) and gdal2tiles

I was using the wrong options in the OSGeo4W installer. If going down the "Express Desktop Install" path, gdal2tiles either comes with the "QGIS", "OpenEV", or "GRASS GIS" option. It's not provided ...
user avatar
  • 243
4 votes

gdal2tiles.py how to find optimal zoom level for leaflet?

I had a case like this, went through gdal2tiles.py source for inspiration and wrote this Python script: from osgeo import gdal def get_optimal_zoom_level (geo_tiff_file_name): geo_tiff = gdal.Open(...
user avatar
  • 181
4 votes

Implementing gdal2tiles tools by using GPU or OpenGL to accelerate speed?

As you say, the bottleneck for tiles generation is usually I/O. GPUs are meant for computationally expensive calculations with rather low I/O. So adding GPU processing will not help for things like ...
user avatar
  • 8,082
4 votes
Accepted

gdal2tiles.py: ERROR 6: PNG driver doesn't support 13 bands

You have 13 band imagery, but to make a PNG tile you need to restrict it to just the 3 RGB values. You can build a VRT "virtual file" that selects just the RGB bands from the source: gdalbuildvrt -b [...
user avatar
  • 3,857
4 votes
Accepted

Mismatch between OpenLayers 5 and XYZ-layer on some zoom-levels

It's not a standard XYZ grid, i.e. the largest tile 25.38836208458858 * 256 = 6499.42069365467648 is bigger than the extent 6729085.88076 - 6724227.18297 = 4858.69779 That wouldn't be a problem if ...
user avatar
  • 9,693
4 votes
Accepted

Convert a .png file to a GeoTIFF while knowing the boundings

The fact that your map appears at Madagascar and not France is the clue here. It means that your axes are swapped (Madagascar is about as far south as France is West). So you need to switch round the ...
user avatar
  • 74.6k
4 votes
Accepted

GDAL3 gdal2tiles AttributeError: 'SpatialReference' object has no attribute 'this'

The steps below have fixed my problems, but I have no idea whether or not I messed up something different. Use at your own risk. Navigate to C:\Users\YOURUSER\AppData\Local\Programs\Python\Python37\...
user avatar
  • 201
3 votes
Accepted

raster tiles from vector data with GDAL - how to avoid aliasing artefacts?

Is my theory correct? It seems so, as I get flawless results with the method described below. If so, how can I determine the precise -ts parameters for gdal_rasterize (or, alternatively, -tr ...
user avatar
  • 1,340
3 votes
Accepted

Can gdal2tiles create tiles at zoom levels > 10?

If you are in doubt, apply a zoom level option of --zoom 8-12 and check all resulting output folders. It always worked for me with this option.
user avatar
  • 74.9k
3 votes

Generating JPEG tiles using gdal2tiles.py?

for resolve the problem of black areas is necessary to proceed this way: 1) create a virtual mosaic of the images with the param -vrtnodata 255: gdalbuildvrt test.vrt -vrtnodata 255 *.tif this add a ...
user avatar
3 votes

gdal2tiles.py problem - creating mini tiles

I just ran into this same/similar problem. What fixed my problem was to make the image large enough for the gdal2tiler to make proper tiles. I made my image evenly divisible by 256px, so this may have ...
user avatar
  • 131
3 votes

Display tiles from a custom GeoTiFF overlayed on googles satellite map using leaflet

You would probably be interested in Leaflet.Control.SideBySide plugin, it provides that exact functionality (demo). However, it assumes that your tiles already perfectly match. I do not know ...
user avatar
  • 6,823
3 votes
Accepted

Creating tile server from geotiff

Rather than reinvent the wheel, I strongly recommend Geoserver. It does exactly what you want, plus has integrated tile caching. It is open source and the de facto implementation of the various OCG ...
user avatar
3 votes
Accepted

specify the bounding box for gdal2tiles

I would use gdal_translate http://www.gdal.org/gdal_translate.html with Virtual raster (.VRT) output http://www.gdal.org/gdal_vrttut.html as an interim format. gdal_translate -of VRT -projwin ulx uly ...
user avatar
  • 51.5k
3 votes

OSgeo4W64 Windows 7 & ImportError: No Module Named Site

Two things (and @rumski20) helped to get this going: I was referencing Python27 not realizing that gdal2tiles requires Python36 I referenced every .exe or .py directly Probably a better way to do ...
user avatar
3 votes
Accepted

Quality of gdal2tiles output

As you noticed from the gdal2tiles documentation https://gdal.org/programs/gdal2tiles.html, the Python script deals well only with 8-bit input images. Note Inputs with non-Byte data type (i.e. Int16, ...
user avatar
  • 51.5k
3 votes
Accepted

No module named 'ogr' in GDAL 3.3.2 installing

EDIT There is actually an open ticket from August, 2021 about this problem in the issue tracker https://github.com/gisinternals/buildsystem/issues/180 The Python modules that gisinternals.com deliver ...
user avatar
  • 51.5k
3 votes
Accepted

How to not generate .png.aux.xml files when using gdal2tiles?

GDAL uses the .aux.xml files to store metadata, including statistics. You can disable completely by setting the environment variable GDAL_PAM_ENABLED=NO though I don't advise doing this permanently. ...
user avatar
  • 51.7k
2 votes

gdal2tiles.py generates wrong tiles / MapTiler the right ones

A late contribution, but perhaps it helps... As an alternative to changing the code in gdal2tiles.py or adding the special flag to leaflet, the file names of the tiles can be changed. This was an ...
user avatar
  • 21
2 votes

Use Gdal2tiles to generate 512px tiles

This is an old question, but I needed the same thing and found a solution. I modified the gdal2tiles.py file (as suggested by user30184). After changing all of the "256" values in the code to "512", I ...
user avatar
  • 121

Only top scored, non community-wiki answers of a minimum length are eligible