[gdal-dev] Using Python gdalwarp to read gif file and world file, re-project to another picture

Sean Gillies sean at mapbox.com
Thu Mar 5 09:24:01 PST 2020


Hi Guodong,

On Wed, Mar 4, 2020 at 9:23 PM Guodong <gd.zhu at outlook.com> wrote:

> Hello,
>
> I want to re-project a radar image
> (https://radar.weather.gov/Conus/RadarImg/latest_radaronly.gif) which is
> in
> NAD83/EPSG4326 to WGS84/Pseudo-Mercator/EPSG3857. There is a world file
> associated with this gif
> (https://radar.weather.gov/Conus/RadarImg/latest_radaronly.gfw). I was
> wondering how can I do this projection using Python gdalwarp package, and
> how to extract the coordinates bounds from the new re-projected picture?
>
> I'm very new to GIS. I know world file contains georeferencing information,
> but I stucked at the first step and don't know how to read gif file along
> with the world file...
>
> Thanks a lot for your time and help!
>
> Best regards,
> Guodong
>

If you save the .gif and the .gfw file to the same directory, so that they
are siblings, GDAL will find the .gfw automatically when the .gif file is
opened. This is a common GIS paradigm. Many GIS file formats are actually
multi-file formats. One file, usually the image file, is the primary file
and it may have auxiliary or "sidecar" files that carry additional
information. A world file is one such auxiliary file.

You can convert and warp like like this:

gdalwarp -r near -s_srs EPSG:4326 -t_srs EPSG:3857 -of GTiff
latest_radaronly.gif warped.tif

The gdalinfo program will show you the bounds of the result and you can
confirm they are what you expect.

-- 
Sean Gillies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200305/2d414f4c/attachment.html>


More information about the gdal-dev mailing list