Niklas
Niklas

Reputation: 103

fuzzy output after gdal2tiles.py on sentinel 2 data

I am trying to set up a tile service for Sentinal2 images.

For testing I use S2A_MSIL2A_20171007T103021_N0205_R108_T32UMC_20171007T103241.SAFE

There I take GRANULE/L2A_T32UMC_A011974_20171007T103241/IMG_DATA/R10m/L2A_T32UMC_20171007T103021_B03_10m.jp2

original Copernicus Sentinel data [2017]' for Sentinel data

gdalinfo L2A_T32UMC_20171007T103021_B03_10m.jp2

Driver: JP2OpenJPEG/JPEG-2000 driver based on OpenJPEG library
Files: L2A_T32UMC_20171007T103021_B03_10m.jp2
       L2A_T32UMC_20171007T103021_B03_10m.jp2.aux.xml
Size is 10980, 10980
Coordinate System is:
PROJCS["WGS 84 / UTM zone 32N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AXIS["Latitude",NORTH],
        AXIS["Longitude",EAST],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",9],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","32632"]]
Origin = (399960.000000000000000,5800020.000000000000000)
Pixel Size = (10.000000000000000,-10.000000000000000)
Corner Coordinates:
Upper Left  (  399960.000, 5800020.000) (  7d31'53.50"E, 52d20'28.85"N)
Lower Left  (  399960.000, 5690220.000) (  7d33'47.90"E, 51d21'15.96"N)
Upper Right (  509760.000, 5800020.000) (  9d 8'35.85"E, 52d21' 1.39"N)
Lower Right (  509760.000, 5690220.000) (  9d 8'24.68"E, 51d21'47.37"N)
Center      (  454860.000, 5745120.000) (  8d20'40.48"E, 51d51'18.19"N)
Band 1 Block=1024x1024 Type=UInt16, ColorInterp=Undefined
  Min=1978.000 Max=13691.000 
  Minimum=1978.000, Maximum=13691.000, Mean=7548.914, StdDev=1541.257
  Overviews: 5490x5490, 2745x2745, 1372x1372, 686x686, 343x343
  Overviews: arbitrary
  Metadata:
    STATISTICS_MAXIMUM=13691
    STATISTICS_MEAN=7548,914
    STATISTICS_MINIMUM=1978
    STATISTICS_STDDEV=1541,2571173571

My idea was to generate the tiles with gdal2tiles.py. But I think my results are not usable.

Running gdal2tiles.py -p raster L2A_T32UMC_20171007T103021_B03_10m.jp2 ./tiles

Generated images in the folders look rather strange to me:

a tile after gdal

I already looked at the documentation and tried to play with the options and read through gis.stackexchange. (https://gis.stackexchange.com/questions/200251/how-to-use-gdal2tiles-on-a-custom-tiff-image-recieved-from-providers-to-generate)

But I was not able to get any closer to a solution. Does someone spot my error and can help me?

Many thanks in advance, for everyone taking the time!

Kind regards Niklas

Upvotes: 3

Views: 505

Answers (1)

Niklas
Niklas

Reputation: 103

I was able to ask an expert for his advice.

This is the solution, that works perfectly for my data:

It seems to be, that gdal2tiles needs explicit unit8 (Byte)

gdal_translate -ot Byte -scale xxx.jp2 out.tif

gdal2tiles.py out.tif tms

Kind regards Niklas

Upvotes: 4

Related Questions