Dear list, thank you for not replying - it made me happier when I discovered the error myself ;)

If gdalwarp is used with '-geoloc' and '-off VRT' and SRC image covers only part of the DST image and block size is small enough to allow one of the blocks to be completely outside the SRC image then gdaltranslate of the generated VRT file fails. That's obviously an error and I will create a ticket with examples and debugging output.

So the solution for the problem is to set the BlockSize to the image size.

With best regards!
Anton

On 04/16/2012 12:12 PM, Anton Korosov wrote:
Dear list,

what does the annoying error 'ERROR 1: Too many points (441 out of 441)
failed to transform' mean?

When I try to warp a MODIS image directly into tif it works perfect:

gdalwarp -t_srs '+proj=latlong' -of GTiff -geoloc -te -4 51 14 66 -ts
900 1400 HDF4_SDS:UNKNOWN:"/data/A2012101111000.L2_LAC.NorthSea.hdf":15
modis_geoloc.tif

But when I try to make the VRT file first it fails with this error:
Commands:

gdalwarp -t_srs '+proj=latlong' -of VRT -geoloc -te -4 51 14 66 -ts 900
1400 HDF4_SDS:UNKNOWN:"/data/A2012101111000.L2_LAC.NorthSea.hdf":15
modis_geoloc.vrt

gdal_translate modis_geoloc.vrt modis_geoloc.vrt.tif

Output:

Input file size is 900, 1400
0ERROR 1: Too many points (441 out of 441) failed to transform,
unable to compute output bounds.
ERROR 1: modis_geoloc.vrt, band 1: IReadBlock failed at X offset 0, Y
offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0


What makes me crazy is that if the output file is smaller (say 500 x
500) it works via the VRT also fine. WHY?!


The VRT file (w/o metadata) is below. The source file (4 MB) is here:
http://hab.nersc.no/NorthSea/A2012101111000.L2_LAC.NorthSea.hdf.bz2

Thank you very much for any hint.
Anton

<VRTDataset rasterXSize="900" rasterYSize="1400"
subClass="VRTWarpedDataset">
<SRS>GEOGCS["WGS
84",DATUM["unknown",SPHEROID["WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]</SRS>

<GeoTransform> -4.0000000000000000e+00, 2.0000000000000000e-02,
0.0000000000000000e+00, 6.6000000000000000e+01, 0.0000000000000000e+00,
-1.0714285714285714e-02</GeoTransform>
<Metadata>
<MDI key="bad_value_scaled">-32767</MDI>
</Metadata>
<VRTRasterBand dataType="Int16" band="1" subClass="VRTWarpedRasterBand">
<ColorInterp>Gray</ColorInterp>
</VRTRasterBand>
<BlockXSize>512</BlockXSize>
<BlockYSize>128</BlockYSize>
<GDALWarpOptions>
<WarpMemoryLimit>6.71089e+07</WarpMemoryLimit>
<ResampleAlg>NearestNeighbour</ResampleAlg>
<WorkingDataType>Int16</WorkingDataType>
<Option name="INIT_DEST">0</Option>
<SourceDataset
relativeToVRT="1">HDF4_SDS:UNKNOWN:/data/A2012101111000.L2_LAC.NorthSea.hdf:15</SourceDataset>

<Transformer>
<ApproxTransformer>
<MaxError>0.125</MaxError>
<BaseTransformer>
<GenImgProjTransformer>
<SrcGeoLocTransformer>
<GeoLocTransformer>
<Reversed>0</Reversed>
<Metadata>
<MDI key="LINE_OFFSET">0</MDI>
<MDI key="LINE_STEP">1</MDI>
<MDI key="PIXEL_OFFSET">0</MDI>
<MDI key="PIXEL_STEP">1</MDI>
<MDI key="SRS">GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]]</MDI>

<MDI key="X_BAND">1</MDI>
<MDI
key="X_DATASET">HDF4_SDS:UNKNOWN:"/data/A2012101111000.L2_LAC.NorthSea.hdf":11</MDI>

<MDI key="Y_BAND">1</MDI>
<MDI
key="Y_DATASET">HDF4_SDS:UNKNOWN:"/data/A2012101111000.L2_LAC.NorthSea.hdf":12</MDI>

</Metadata>
</GeoLocTransformer>
</SrcGeoLocTransformer>

<DstGeoTransform>-4,0.02,0,66,0,-0.01071428571428571</DstGeoTransform>

<DstInvGeoTransform>200,49.99999999999999,0,6159.999999999999,0,-93.33333333333333</DstInvGeoTransform>

<ReprojectTransformer>
<ReprojectionTransformer>
<SourceSRS>GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]]</SourceSRS>

<TargetSRS>GEOGCS["WGS
84",DATUM["unknown",SPHEROID["WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]</TargetSRS>

</ReprojectionTransformer>
</ReprojectTransformer>
</GenImgProjTransformer>
</BaseTransformer>
</ApproxTransformer>
</Transformer>
<BandList>
<BandMapping src="1" dst="1" />
</BandList>
</GDALWarpOptions>
</VRTDataset>

_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to