[gdal-dev] gdalwarp eats scale and offset

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] gdalwarp eats scale and offset

Kyle Shannon
If I have a dataset with a scale and offset:

kyle@ubuntu:~/Desktop$ gdalinfo test.tif
Driver: GTiff/GeoTIFF
Files: test.tif
Size is 738, 919
Coordinate System is:
PROJCS["WGS 84 / UTM zone 12N",
...
Origin = (279635.000000000000000,4878315.000000000000000)
Pixel Size = (30.000000000000000,-30.000000000000000)
Metadata:
AREA_OR_POINT=Point
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 279635.000, 4878315.000) (113d44'58.90"W, 44d 1'29.65"N)
Lower Left ( 279635.000, 4850745.000) (113d44'17.87"W, 43d46'37.04"N)
Upper Right ( 301775.000, 4878315.000) (113d28'25.33"W, 44d 1'52.37"N)
Lower Right ( 301775.000, 4850745.000) (113d27'48.41"W, 43d46'59.57"N)
Center ( 290705.000, 4864530.000) (113d36'22.60"W, 43d54'14.96"N)
Band 1 Block=738x1 Type=Float32, ColorInterp=Gray
Offset: 1, Scale:0.1

and I warp the image:

kyle@ubuntu:~/Desktop$ gdalwarp -t_srs epsg:4326 test.tif warp.tif
Creating output file that is 901P x 800L.
Processing input file test.tif.
0...10...20...30...40...50...60...70...80...90...100 - done.

My scale and offset disappear:

kyle@ubuntu:~/Desktop$ gdalinfo warp.tif

Driver: GTiff/GeoTIFF
Files: warp.tif
Size is 901, 800
Coordinate System is:
GEOGCS["WGS 84",
...
Origin = (-113.749693430469137,44.031215259056744)
Pixel Size = (0.000317850797006,-0.000317850797006)
Metadata:
AREA_OR_POINT=Point
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left (-113.7496934, 44.0312153) (113d44'58.90"W, 44d 1'52.37"N)
Lower Left (-113.7496934, 43.7769346) (113d44'58.90"W, 43d46'36.96"N)
Upper Right (-113.4633099, 44.0312153) (113d27'47.92"W, 44d 1'52.37"N)
Lower Right (-113.4633099, 43.7769346) (113d27'47.92"W, 43d46'36.96"N)
Center (-113.6065016, 43.9040749) (113d36'23.41"W, 43d54'14.67"N)
Band 1 Block=901x2 Type=Float32, ColorInterp=Gray

I couldn't find any docs on this. Is this known and/or expected? I would think scale and offset would be transferred to the new file.

/**
 *
 * Kyle Shannon
 * [hidden email]
 *
 */




_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: gdalwarp eats scale and offset

Frank Warmerdam
On Wed, Mar 21, 2012 at 3:01 PM, Kyle Shannon <[hidden email]> wrote:
> If I have a dataset with a scale and offset:
...
> I couldn't find any docs on this. Is this known and/or expected? I would
> think scale and offset would be transferred to the new file.

Kyle,

Scale and offset are basically a form of metadata, and it is ambiguous
how much metadata gets transferred by processing tasks, like gdalwarp.
In cases where gdalwarp is being used to warp into an existing output
file it would not be appropriate to transfer the scale and offset.
However, in the case that gdalwarp is initializing a new output file
it would seem reasonable to also copy over the scale and offset.

I believe some recent changes were made to copy other metadata,
and this would seem to fall into a similar category.  I'd suggest
fixing yourself, or writing up a ticket on the topic.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: gdalwarp eats scale and offset

Etienne Tourigny-3
I am the author of those changes (adding metadata copy to gdalwarp),
and I must confess I had not thought of scale and offset.

What I did do was add non-conflicting metadata (at the dataset and
band level) and some band-related stuff like description.
I have just tested and gdalwarp does not pass the offset and scale_factor.

Kyle - could you check out trunk and have a look? If you need any
pointers on the new code just ask.

regards,
Etienne

On Wed, Mar 21, 2012 at 7:08 PM, Frank Warmerdam <[hidden email]> wrote:

> On Wed, Mar 21, 2012 at 3:01 PM, Kyle Shannon <[hidden email]> wrote:
>> If I have a dataset with a scale and offset:
> ...
>> I couldn't find any docs on this. Is this known and/or expected? I would
>> think scale and offset would be transferred to the new file.
>
> Kyle,
>
> Scale and offset are basically a form of metadata, and it is ambiguous
> how much metadata gets transferred by processing tasks, like gdalwarp.
> In cases where gdalwarp is being used to warp into an existing output
> file it would not be appropriate to transfer the scale and offset.
> However, in the case that gdalwarp is initializing a new output file
> it would seem reasonable to also copy over the scale and offset.
>
> I believe some recent changes were made to copy other metadata,
> and this would seem to fall into a similar category.  I'd suggest
> fixing yourself, or writing up a ticket on the topic.
>
> Best regards,
> --
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Software Developer
> _______________________________________________
> gdal-dev mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev