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

geep999 geep999 at yahoo.co.uk
Thu Nov 10 15:58:01 EST 2011


Hi,
I'm having big problems understanding what's happening with tiles created
by gdal2tiles.py --version GDAL 1.8.1, released 2011/07/09
Running on Slackware 13.37 64 bit.

The results of tiling a colour relief look OK:
http://pgg999.freehostingcloud.com/tiles4_srtm/openlayers.html
http://pgg999.freehostingcloud.com/tiles4_srtm/openlayers.html 
(The file openlayers.html was also created by gdal2tiles.py)

But I can't understand the naming of the tiles created by gdal2tiles.py.

For example - consider a couple of tiles created by other folk for Harlow,
Essex,UK at zoom 11
http://tile.openstreetmap.org/11/1024/678.png
http://tile.openstreetmap.org/11/1024/678.png 
http://steve8.dev.openstreetmap.org/railway_tiles/11/1024/678.png
http://steve8.dev.openstreetmap.org/railway_tiles/11/1024/678.png 

For these I can understand the z/x/y of 11/1024/678 
and http://almien.co.uk/OSM/Tools/Coord/?x=1024&y=678&z=11
gives:
Latitude: 51.726959 to 51.835708	Longitude: 0.000000 to 0.175781
Size: 0.175781 x 0.108749		Centre: 51.781333, 0.087891

But my gdal2tiles.py has named the same area 11/1024/1369
http://pgg999.freehostingcloud.com/tiles4_srtm/11/1024/1369.png
http://pgg999.freehostingcloud.com/tiles4_srtm/11/1024/1369.png 
I attach, below at the bottom, the gdal2tiles.py command I used and details
of the source geotiff image.

For z/x/y of 11/1024/1369
  http://almien.co.uk/OSM/Tools/Coord/?x=1024&y=1369&z=11
http://almien.co.uk/OSM/Tools/Coord/?x=1024&y=1369&z=11 
gives:
Latitude: -51.835708 to -51.726959	Longitude: 0.000000 to 0.175781
Size: 0.175781 x 0.108749		Centre: -51.781333, 0.087891

Seems the tile is being created in the southern hemisphere in the South
Atlantic.
The geotiff image used to create the tiles is definitely in the Northen
Hemisphere - Eastern England.

Yet as you can see everything looks OK in
http://pgg999.freehostingcloud.com/tiles4_srtm/openlayers.html

I created a stripped down version of the tile pyramid that only contains one
tile.

http://pgg999.freehostingcloud.com/tiles4_srtm_1tile/openlayers.zoom11.html
http://pgg999.freehostingcloud.com/tiles4_srtm_1tile/openlayers.zoom11.html 
http://pgg999.freehostingcloud.com/tiles4_srtm_1tile/11/1024/1369.png
http://pgg999.freehostingcloud.com/tiles4_srtm_1tile/11/1024/1369.png 

/Can anybody help me to understand:
1/ Why is gdalstiles.py apparently creating tiles in the Southern Hemisphere
which should be in the Northern?
Specificially - 11/1024/1369.png should be 11/1024/678.png
2/ Why is a tile that, according to its name, should be displayed in the
South Atlantic appearing in Essex, England? 
Or should I ask this question to the Openlayers folks?/

This is causing me lots of problems when I try to use my tiles along with
other tiles.
Then my tiles are appearing in the "wrong" place - i.e. the Southern
Atlantic.
I don't have a presentable example of this yet. It's taken me long enough to
get this far!
At the moment I'm wondering if there are bugs in both gdal2tiles.py and 
http://www.openlayers.org/api/2.7/OpenLayers.js
http://www.openlayers.org/api/2.7/OpenLayers.js 

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-hemisphere-and-or-Openlayers-problem-tp6983306p6983306.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list