You are not logged in.

#1 2008-04-22 11:15:02

emj
Member
From: .se (59.3N17.99E) 0735969076
Registered: 2006-06-18
Posts: 949

Creating World files (jgw etc)

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

Offline

#2 2008-04-22 11:16:14

emj
Member
From: .se (59.3N17.99E) 0735969076
Registered: 2006-06-18
Posts: 949

Re: Creating World files (jgw etc)

breaking out relevant posts from old discussion.

JRA wrote:

Yes, it is great.  I am only missing one more option: Automaticly generated ESRI world files or something else for simple georeferencing.  Of course the bounding box coordinates are already giving enough information for a bit more advanced users to write manually MapInfo .tab files or OziExplorer .map calibration files, but they are not the most widely supported formats.

emj wrote:

So do you know
* where you can read up on how to create them
* which image format does the work for?
* can you use the Projection OSM uses, or will there have to be conversions first?
* how those files work?

I suspect the most interesting thing todo is to make it easier to import into Illustrator and making it easier to manipulate data in 3rd party programs..

JRA wrote:

Here is something about MapInfo and Ozi formats.  They both share the same idea of connecting a few pixels in an image to geographical coordinates.  In principle the system works with any image format but of course it is not guaranteed what formats client software support.  For accurate interpolation both MapInfo and Ozi want to know the name of the projection but I have not found anything suitable for the spherical Mercator used by OSM slippy maps.  I have used WGS84 Lat/Lon coordinates instead and they work well at least with small maps I have been playing with.

It was more simple to find some reading about MapInfo tab than about OziExplorer format. Perhaps info@oziexplorer.com would give
information  about the latter. About MapInfo tab the following links seem to give some correct information:

http://mitab.maptools.org/
http://testdrive.mapinfo.com/TECHSUPP/M … enDocument
http://free-zg.t-com.hr/gorantt/geo/tfw2tab.htm
http://www.directionsmag.com/mapinfo-l/mif/AppJ.pdf

Here are commented examples of MapInfo .tab and OziExplorer .map files which are giving a working result even the projection settings in both are most propably wrong because I do not know what would be the correct values.

MapInfo tab:

!table
!version 400
!charset Windowsutf8

Definition Table
  File "Helsinki.png" #Name of the correspoinding image file
  Type "RASTER"
  (24.919740,60.176970) (0,0) Label "Pt 1",    #Coordinates and image pixel values of Ground Control Point number 1
  (24.952700,60.176970) (3072,0) Label "Pt 2",
  (24.952700,60.160570) (3072,3072) Label "Pt 3"
  CoordSys Earth Projection 1, 104                #MapInfo definitions strings for the projection
  Units "degree"                                           #Map units

OziExplorer .map:

OziExplorer Map Data File Version 2.2
Helsinki2          #Name that OziExplorer will show in a map list
Helsinki2.png    #Name of the corresponding image file
1 ,Map Code,
WGS 84,WGS 84,   0.0000,   0.0000,WGS 84 
Reserved 1
Reserved 2
Magnetic Variation,,,E
Map Projection,Transverse Mercator,PolyCal,No,AutoCalOnly,No,BSBUseWPX,No  #Something about projection, obviously wrong?
Point01,xy,0,0,in,deg,60,10.6182,N,24,55.1844,E, grid,,,,     #Image pixel values ans coordinates Ground Control Point number 1
Point02,xy,3072,0,in,deg,60,10.6182,N,24,57.1620,E, grid,,,,
Point03,xy,3072,3072,in,deg,60,09.6342,N,24,57.1620,E, grid,,,,
Point04,xy,0,3072,in,deg,60,09.6342,N,24,55.1844,E, grid,,,,

Projection Setup, 0.000000000, 30.0, 1.000000000, 4500000.0, 0.00,,,,,  #These last lines are used by OziExplorer software
Map Feature = MF ; Map Comment = MC     These follow if they exist
Track File = TF      These follow if they exist
Moving Map Parameters = MM?    These follow if they exist
MM0,Yes
MMPNUM,4
MMPXY,1,0,0
MMPXY,2,3072,0
MMPXY,3,3072,3072
MMPXY,4,0,3072
MMPLL,1, 24.919740, 60.176970
MMPLL,2, 24.952700, 60.176970
MMPLL,3, 24.952700, 60.160570
MMPLL,4, 24.919740, 60.160570
MM1B, 4.00
MOP,Map Open Position,0,0
IWH,Map Image Width/Height,3072,3072

Offline

#3 2008-04-22 17:45:23

JRA
Member
Registered: 2007-12-17
Posts: 671

Re: Creating World files (jgw etc)

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.

Offline

#4 2008-04-23 00:27:52

usm78-gis
Member
Registered: 2008-04-21
Posts: 2,573

Re: Creating World files (jgw etc)

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

Offline

Board footer

Powered by FluxBB