Creating World files (jgw etc)

This top post should contain information on how to take image from OSM and import into other places.

breaking out relevant posts from old discussion.

Tomorrow seems to come two months from the birth of an application that can automatically store both the image captured from OSM tile servers and the corresponding calibration files in .tab and .map formats. It supports also saving in bmp, gif and tif formats. User can also select if alfa channel should be included of not (24 bit/32 bit). The application can be found at
http://alpo.hassinen.googlepages.com/osm-map

Application seems to be only in Finnish but there is not so much text in the user interface.

It is very easy to generate the world file for a given /Z/X/Y.png tile,
here is an example for the downtown Helsinki (/18/149235/75876.png):

awk 'END{
R=6378137.;
M_PI=3.14159265358979323846;
mpix=2*M_PI*R/2^(8+z);
merc_x=2*M_PI*R*(x-2^(z-1))/2^z;
merc_y=2*M_PI*R*(2^(z-1)-y)/2^z;
printf("%.9f\n0.0\n0.0\n-%.9f\n%.9f\n%.9f\n",mpix,mpix,merc_x,merc_y);
}' x=149235 y=75876 z=18 < /dev/null > tile_149235_75876_18.pgw

The projection used by OSM is NOT (!) Mercator on a WGS84 ellipsoid like in the ozi exploiter example
above, but the Mercator on a sphere with the radius equal to WGS84 major axis (a=6378137 meters)

Both projections below are wrong too:
latlong projection on the WGS84 ellipsoid EPSG:4326

CoordSys Earth Projection 1, 104

and a mixture of the KKJ zone 4 projection used in eastern Finland (EPSG:2394) and the WGS84 ellipsoid
(nobody uses something like that in real life)

WGS 84,WGS 84,   0.0000,   0.0000,WGS 84 
Map Projection,Transverse Mercator,PolyCal,No,AutoCalOnly,No,BSBUseWPX,No  #Something about projection, obviously wrong?
Projection Setup, 0.000000000, 30.0, 1.000000000, 4500000.0, 0.00,,,,,  #These last lines are used by OziExplorer software