Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Im using the following to try to produce a tms tileset:

gdalbuildvrt test.vrt *.tif 
gdal2tiles -p raster --zoom=0-6 test.vrt out

Two tifs work fine, more than that and it seems to miscompute the resolution and i end up with tiles that have a small image top left with 3/4 of the tile empty

gdalinfo shows:

PROJCS["Transverse Mercator; New Zealand Geodetic Datum 2000; GRS80",
    GEOGCS[,
    DATUM["unknown",
        SPHEROID["GRS 1980",6378137,298.2572221010002,
        AUTHORITY["EPSG","7019"]]],
    PRIMEM["Greenwich",0],
    UNIT[,0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",173],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",1600000],
    PARAMETER["false_northing",10000000],
    UNIT["metre",1,
    AUTHORITY["EPSG","9001"]]]
Origin = (1419997.883500000000000,5154002.116499999500000)
Pixel Size = (4.233000000000000,-4.233000000000000)
Metadata:
  TIFFTAG_IMAGEDESCRIPTION=Composite
  TIFFTAG_XRESOLUTION=300
  TIFFTAG_YRESOLUTION=300
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  ( 1419997.884, 5154002.116) (170d45'51.96"E, 43d44'42.58"S)
Lower Left  ( 1419997.884, 5118000.451) (170d45' 8.17"E, 44d 4' 8.61"S)
Upper Right ( 1444003.227, 5154002.116) (171d 3'44.60"E, 43d45' 2.17"S)
Lower Right ( 1444003.227, 5118000.451) (171d 3' 6.65"E, 44d 4'28.43"S)
Center      ( 1432000.555, 5136001.284) (170d54'27.89"E, 43d54'35.81"S)
Band 1 Block=5671x17 Type=Byte, ColorInterp=Red
Band 2 Block=5671x17 Type=Byte, ColorInterp=Green
Band 3 Block=5671x17 Type=Byte, ColorInterp=Blue

Do i need to manually specify the resolution and if so how?

share|improve this question

1 Answer 1

Seems to be the classic case of stale or poor documentation.

After a good deal of trial and error, this seems to work:

gdalbuildvrt -resolution lowest test.vrt BX*.tif BY*.tif
gdal2tiles -p raster -s nztm.prj test.vrt out

To be safe, i got a fresh prj from http://spatialreference.org/ref/epsg/2193/ and put that in nztm.prj

TBH im not sure what was the issue, just that both tools are not well documented, and various guides on the net probably relate to older versions. One or more of the following may have been the culprit,

  • incorrect projection metadata in the source geotiffs
  • conflicting resolution metadata ditto
  • wrong zoom level parameter to g2t

zoom level 0 = one tile fits bounds of source, quadtreeing until source resolution reached which could be any zoom level from 1 to 20. When in doubt leave it off! For the manual see gdal2tiles -help, not the copy on gdals website, which is outdted.

share|improve this answer
    
From my research on this question: gis.stackexchange.com/questions/88305/… I assume that gdal2tiles does not like -z and -p raster together. –  AndreJ Jun 18 at 19:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.