[gdal-dev] decimal rounding issue when re-projecting

Ramiro Marco Figuera r.marcofiguera at jacobs-university.de
Fri Jul 17 00:19:25 PDT 2015


Hi,

Thanks a lot for the quick answer. Indeed, adding the -tr 20 20 solved 
the problem. As you pointed out, it should be possible to do the 
transformation in one step, however I want to keep an intermediate .tif 
file for visualization.

The 20/21m per pixel resolution I had at first, even if gdalwarp does no 
keep the resolution, is due to the fact that so close to the south pole 
the distortion/difference between polar stereographic and polar gnomonic 
is quite small.

Again, thanks a lot for the answer,

Cheers,

Ramiro

On 07/16/2015 05:41 PM, Jukka Rahkonen wrote:
> Ramiro Marco Figuera <r.marcofiguera <at> jacobs-university.de> writes:
>
>> Hi,
>>
>> I'm re-projecting (from stereographic to gnomonic) the PDS LOLA 20m/pix
>> DTMS from the lunar south pole. Im using gdalwarp like this: 'gdalwarp
>> -t_srs '+proj=gnom +lat_0=-90 +lat_ts=-90 +lon_0=0 +k=1 +x_0=0 +y_0=0
>> +a=1737400 +b=1737400 +units=m +no_defs' topo_stereo.tif topo_gnom.tif'
>> .  After that, I'm cropping the DTM to have a smaller region (200km by
>> 200km) around the pole. Then, I just use gdal_translate to export it as
>> XYZ since I need it in this format for my software and converting it to
>> kilometers instead of meters using awk.  As this is a gridded data, the
>> resolution should remain the same (20m/pixel), however when I check the
>> first entries of my xyz file the resolution is sometimes 21 m/pixel and
>> sometimes 20 m/pixel, and this happens randomly. Any clue of what may
>> cause this error? Has anyone faced the same issue?
> Hi,
>
> Gdalwarp does not try to keep resolution unchanged and I guess that the
> reason is to avoid extra resampling. That your output is so close to 20
> m/pix is a coincident. Varying 20/21 m pixel size in xyz file may be due to
> rounding errors. Have you checked the pixel size of topo_gnom.tif with
> gdalinfo?
>
> I would try what happens when running gdalwarp with -tr 20 20 for forcing
> the output resolution to 20m/pix.
>
> You should be able to crop and create 20 m/pixel xyz file with one run by
> setting the resolution with -tr and selecting the format with -of and
> defining extents with -te http://www.gdal.org/gdalwarp.html
>
> -Jukka Rahkonen-
>
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Ramiro Marco Figuera
Department of Physics and Earth Sciences
Jacobs University Bremen
Campus Ring 1, 28759 Bremen, Germany
Office: Research III, Room 99b
Tel: +49 (0)421 200 3226



More information about the gdal-dev mailing list