[gdal-dev] gdal2tiles: tiles in wrong hemisphere, and/or Openlayers problem

Even Rouault even.rouault at mines-paris.org
Thu Nov 10 18:49:31 EST 2011


> At the moment I'm wondering if there are bugs in both gdal2tiles.py and
> http://www.openlayers.org/api/2.7/OpenLayers.js

I think there's a bug in none of them ;-)

You just have run into this embarrassing mess where OpenStreetMap and TMS tile 
numbering convention are different. In TMS, tile 0 is in the south pole, 
whereas in OSM it is the north-pole. See the note at the bottom of 
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames

So provided you integrate your gdal2tiles-generated tiles in a TMS layer of 
OpenLayers, this should work fine.

> 
> Cheers,
> Peter
> 
> Command used to create tile:
> gdal2tiles.py --zoom=0-14
> --url=http://pgg999.freehostingcloud.com/tiles_srtm/ \
> -v N5xE000.srtm.colourrelief.tif tiles4_srtm
> 
> Details of the colour relief file that was tiled.
> (It is actually 9 SRTM tiles stitched together with gdal_merge.py).
> gdalinfo -stats
> /media/space5/ordnance_survey_data/bdline_gb/data/N5xE000.srtm.colourrelief
> .tif Driver: GTiff/GeoTIFF
> Files:
> /media/space5/ordnance_survey_data/bdline_gb/data/N5xE000.srtm.colourrelief
> .tif
> 
> /media/space5/ordnance_survey_data/bdline_gb/data/N5xE000.srtm.colourrelief
> .tif.aux.xml Size is 3601, 3601
> Coordinate System is:
> 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"]]
> Origin = (-1.000416666666667,53.000416666666666)
> Pixel Size = (0.000833333333333,-0.000833333333333)
> Metadata:
>   AREA_OR_POINT=Area
> Image Structure Metadata:
>   INTERLEAVE=PIXEL
> Corner Coordinates:
> Upper Left  (  -1.0004167,  53.0004167) (  1d 0' 1.50"W, 53d 0' 1.50"N)
> Lower Left  (  -1.0004167,  49.9995833) (  1d 0' 1.50"W, 49d59'58.50"N)
> Upper Right (   2.0004167,  53.0004167) (  2d 0' 1.50"E, 53d 0' 1.50"N)
> Lower Right (   2.0004167,  49.9995833) (  2d 0' 1.50"E, 49d59'58.50"N)
> Center      (   0.5000000,  51.5000000) (  0d30' 0.00"E, 51d30' 0.00"N)
> Band 1 Block=3601x1 Type=Byte, ColorInterp=Red
>   Min=46.000 Max=251.000
>   Minimum=46.000, Maximum=251.000, Mean=111.271, StdDev=75.256
>   Metadata:
>     STATISTICS_MINIMUM=46
>     STATISTICS_MAXIMUM=251
>     STATISTICS_MEAN=111.2714725406
>     STATISTICS_STDDEV=75.256273643809
> Band 2 Block=3601x1 Type=Byte, ColorInterp=Green
>   Min=55.000 Max=255.000
>   Minimum=55.000, Maximum=255.000, Mean=175.914, StdDev=36.022
>   Metadata:
>     STATISTICS_MINIMUM=55
>     STATISTICS_MAXIMUM=255
>     STATISTICS_MEAN=175.91388581082
>     STATISTICS_STDDEV=36.021876564052
> Band 3 Block=3601x1 Type=Byte, ColorInterp=Blue
>   Min=31.000 Max=238.000
>   Minimum=31.000, Maximum=238.000, Mean=94.943, StdDev=16.832
>   Metadata:
>     STATISTICS_MINIMUM=31
>     STATISTICS_MAXIMUM=238
>     STATISTICS_MEAN=94.942947441009
>     STATISTICS_STDDEV=16.832038042577
> 
> 
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/gdal2tiles-tiles-in-wrong-hemispher
> e-and-or-Openlayers-problem-tp6983306p6983306.html Sent from the GDAL - Dev
> mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list