[gdal-dev] problem with gdalwarp in 1.7
Frank Warmerdam
warmerdam at pobox.com
Fri Nov 19 12:04:41 EST 2010
geographika wrote:
> Hi,
>
> I have upgraded from GDAL 1.6 (32bit Windows) to 1.7 (64 bit Windows)
> and the following command no longer works:
>
> C:\mapserver\bin\gdal\apps\gdalwarp C:\Data\Rasters\MiscSuit.tif
> C:\RasterClips\mytest.tif -cutline c:\RasterClips\hello.json -te
> 118008.672141 177232.164284 138695.761666 206164.398565 -dstnodata -9999
>
> I get the following message in the command prompt:
>
> Creating output file that is 414P x 579L.
> Processing input file C:\Data\Rasters\MiscSuit.tif.
> for band 1, destination nodata value has been clamped to 0, the
> original value being out of range.
> ERROR 1: Failed to parse CUTLINE geometry wkt.
>
> The CUTLINE is valid GeoJSON (but would clearly be invalid WKT) and
> produces the correct results in 1.6.
> The ogr formats lists GeoJSON as read/write.
> I am using 64-bit builds of GDAL taken from http://vbkto.dyndns.org/sdk/
> I have also tried using the development version of GDAL 1.8dev but get
> the same message. If I do not use a CUTLINE the gdalwarp completes
> successfully but the new image does not contain any data from my
> original image (all cells are NoData).
Seth,
Can you make the .json file available? Does it work with OGR? Try
ogrinfo on it.
Hmm, tracking through the code the LoadCutline() function in gdalwarp.cpp
will read from the OGR datasource and convert the geometry to WKT which is
attached to the cutline property of the warp. Later GDALWarpOperation::
Initialize() turns that into a polygon object and that is where the message
is coming from. So I am *suspecting* improper WKT of some type is getting
produced somehow. We will really need to see the WKT that is causing the
error to know more.
If you are comfortable rebuilding things then try changing:
const char *pszCutlineWKT =
CSLFetchNameValue( psOptions->papszWarpOptions, "CUTLINE" );
if( pszCutlineWKT )
{
in the file gdal/alg/gdalwarpoperation.cpp to something like:
const char *pszCutlineWKT =
CSLFetchNameValue( psOptions->papszWarpOptions, "CUTLINE" );
if( pszCutlineWKT )
{
printf( "WKT = %s\n", pszCutlineWKT );
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list