Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6742 closed defect (invalid)

gdalwarp fails to reproject Sentinel-2A UTM to lat-long: ERROR 1: Attempt to create 0x0 dataset is illegal,sizes must be larger than zero.

Reported by: Markus Neteler Owned by: warmerdam
Priority: normal Milestone: 2.1.3
Component: Algorithms Version: unspecified
Severity: normal Keywords: sentinel, JP2, gdalwarp
Cc:

Description

Using gdalwarp --version GDAL 2.1.2, released 2016/10/24

I have no success to reproject S2 Data to LatLong (EPSG:4326) which other EPSG code work fine:

gdalwarp -t_srs EPSG:4326 -tr 10 10 -r bilinear -co COMPRESS=DEFLATE -co BIGTIFF=YES S2A_USER_MSI_L2A_TL_SGS__20160706T080808_A005420_T49NCC_B03_10m.jp2 S2A_USER_MSI_L2A_TL_SGS__20160706T080808_A005420_T49NCC_B03_10m_LL.tif
Creating output file that is 0P x 0L.
ERROR 1: Attempt to create 0x0 dataset is illegal,sizes must be larger than zero.

Here again with debug output:

PROJ_DEBUG=ON CPL_DEBUG=ON gdalwarp -t_srs EPSG:4326 -tr 10 10 -r bilinear -co COMPRESS=DEFLATE -co BIGTIFF=YES S2A_USER_MSI_L2A_TL_SGS__20160706T080808_A005420_T49NCC_B03_10m.jp2 S2A_USER_MSI_L2A_TL_SGS__20160706T080808_A005420_T49NCC_B03_10m_LL.tif
OPENJPEG: info: Start to read j2k main header (0).
OPENJPEG: info: Main header has been correctly decoded.
OPENJPEG: Grayscale color space
GDALJP2Metadata: Found GML Box:
<gml:FeatureCollection
   xmlns:gml="http://www.opengis.net/gml"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlJP2Profile/1.0.0/gmlJP2Profile.xsd">
  <gml:boundedBy>
    <gml:Envelope srsName="urn:ogc:def:crs:EPSG::32649">
      <gml:lowerCorner>300000 190200</gml:lowerCorner>
      <gml:upperCorner>409800 300000</gml:upperCorner>
    </gml:Envelope>
  </gml:boundedBy>
  <gml:featureMember>
    <gml:FeatureCollection>
      <gml:featureMember>
        <gml:RectifiedGridCoverage dimension="2" gml:id="RGC0001">
          <gml:rectifiedGridDomain>
            <gml:RectifiedGrid dimension="2">
              <gml:limits>
                <gml:GridEnvelope>
                  <gml:low>0 0</gml:low>
                  <gml:high>10979 10979</gml:high>
                </gml:GridEnvelope>
              </gml:limits>
              <gml:axisName>x</gml:axisName>
              <gml:axisName>y</gml:axisName>
              <gml:origin>
                <gml:Point gml:id="P0001" srsName="urn:ogc:def:crs:EPSG::32649">
                  <gml:pos>300005 299995</gml:pos>
                </gml:Point>
              </gml:origin>
              <gml:offsetVector srsName="urn:ogc:def:crs:EPSG::32649">10 0</gml:offsetVector>
              <gml:offsetVector srsName="urn:ogc:def:crs:EPSG::32649">0 -10</gml:offsetVector>
            </gml:RectifiedGrid>
          </gml:rectifiedGridDomain>
          <gml:rangeSet>
            <gml:File>
              <gml:rangeParameters/>
              <gml:fileName>gmljp2://codestream/0</gml:fileName>
              <gml:fileStructure>Record Interleaved</gml:fileStructure>
            </gml:File>
          </gml:rangeSet>
        </gml:RectifiedGridCoverage>
      </gml:featureMember>
    </gml:FeatureCollection>
  </gml:featureMember>
</gml:FeatureCollection>

GDALJP2Metadata: Got projection from GML box: PROJCS["WGS 84 / UTM zone 49N",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",111],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","32649"]]
GDAL: GDALOpen(S2A_USER_MSI_L2A_TL_SGS__20160706T080808_A005420_T49NCC_B03_10m.jp2, this=0x5562dc11b040) succeeds as JP2OpenJPEG.
OGRCT: PROJ >= 4.8.0 features enabled
OGRCT: Using locale-safe proj version
OGRCT: Source: +proj=utm +zone=49 +datum=WGS84 +units=m +no_defs
OGRCT: Target: +proj=longlat +datum=WGS84 +no_defs
OGRCT: Source: +proj=longlat +datum=WGS84 +no_defs
OGRCT: Target: +proj=utm +zone=49 +datum=WGS84 +units=m +no_defs
OGRCT: Source: +proj=utm +zone=49 +datum=WGS84 +units=m +no_defs
OGRCT: Target: +proj=longlat +datum=WGS84 +no_defs
OGRCT: Source: +proj=longlat +datum=WGS84 +no_defs
OGRCT: Target: +proj=utm +zone=49 +datum=WGS84 +units=m +no_defs
Creating output file that is 0P x 0L.
ERROR 1: Attempt to create 0x0 dataset is illegal,sizes must be larger than zero.
GDAL: GDALClose(S2A_USER_MSI_L2A_TL_SGS__20160706T080808_A005420_T49NCC_B03_10m.jp2, this=0x5562dc11b040)
GDAL: In GDALDestroy - unloading GDAL shared library.

Is there a reason for this or is it a bug? Thanks.

Change History (2)

comment:1 by Even Rouault, 7 years ago

Resolution: invalid
Status: newclosed

Yes, -tr 10 10 doesn't make sense when reprojecting to EPSG:4326. It must be in the unit of the target SRS, so degrees here.

in reply to:  1 comment:2 by Markus Neteler, 7 years ago

Replying to rouault:

Yes, -tr 10 10 doesn't make sense when reprojecting to EPSG:4326. It must be in the unit of the target SRS, so degrees here.

Right, I overlooked the -tr values in the originally way longer cmd line. Sorry for the noise.

Perhaps the error message include a hint to check the -tr settings (in case of LatLong being the target srs).

Note: See TracTickets for help on using tickets.