[Mapserver-users] generating world files

Thorsten Fischer thfischer at mapmedia.de
Wed Apr 16 10:54:16 EDT 2003


Heiko,
 
> i`m wondering if it is possiple to generate a .tfw file for a rendered
> map in mapserver, 
> maybe like: 
>  
> $tfw = $map->getworldfile(); 

This is fairly easy to do.  A worldfile consists of 6 lines of ascii:

[width of a pixel in map coordinates]
[a rotation factor] <- you can most likely skip this
[another rotation factor] <- same
[height of a pixel in map coordinates]
[x of upper left corner of the image]
[y of upper left corner of the image]

That's all. You can get parameters 5 and 6 from your current image
extent, fill in the rotation parameters with 0.00000 most likely, and
then calculate parameters 1 and 4 yourself. Hint: first parameter is
(maxx - minx) / (width of map in pixels).



hth,

thorsten 




More information about the mapserver-users mailing list