[Mapserver-users] Converting from png to geotiff with gdal

Richard Greenwood Rich at GreenwoodMap.com
Mon Jun 9 19:21:03 EDT 2003


--=======6883333E=======
Content-Type: text/plain; x-avg-checked=avg-ok-6C4111B5; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit

At 09:51 PM 6/9/2003 +0200, you wrote:

>Hi all
>
>     I want to include into mapserver a new layer based on a collection of 
> raster files i have in PNG format, i know the extents values for each 
> image ( they are named as this: mad_441600-4478928_442581-4479909.png ), 
> it seems i need to convert them to tiff (or geotiff?) format so i can 
> include them in my project and then make an index from them, but i can't 
> just get along the first step.
>
>    I've tried using gdal utilities to convert them from png to a tiff 
> with the geometry information using this:
>
>gdalwarp -s_srs EPSG:23030 -t_srs EPSG:23030 -te 444544 4481872 445525 
>4482853 mad_444544-4481872_445525-4482853.png test.tiff
>
>But instead of a brand new tiff image this is what i get :
>
>ERROR 1: Unable to compute a transformation between pixel/line
>and georeferenced coordinates for mad_444544-4481872_445525-4482853.png.
>There is no affine transformation and no GCPs.

I would use gdal_translate rather than gdalwarp because you are not trying 
to change the projection, but that is not your problem.

The coordinates of the image are in the file name, but no software that I 
am aware of is setup to read the coordinates in such a format. You need to 
convert the coordinates into a world file (*.wld or *.tfw). The world file 
is a separate, ASCII file having the same name (but .wld or .tfw extension) 
as the image file. It containing the coordinates of the upper left image 
pixel, the X and Y dimensions of each image pixel, and the rotation (must 
be 0,0).

So for each image you need to create this world file, either by hand or by 
script.

Rich


Richard W. Greenwood, PLS
Greenwood Mapping, Inc.
Rich at GreenwoodMap.com
(307) 733-0203
http://www.GreenwoodMap.com 

--=======6883333E=======--




More information about the mapserver-users mailing list