Howto:Georeferencing OSM maps in WED

From FlightGear wiki
Jump to navigation Jump to search
This has been nominated for deletion since 16 November 2024. To discuss it, please visit the talk page.

Do not remove this tag until the discussion is closed.


Reason for the nomination: This article either contains out of date information and/or may not meet the quality standards of the wiki.


Deprecated  Please note that current versions of WorldEditor can display OSM background images natively using the "Slippy Map" feature.

When creating airport layouts, not everyone can use aerial images like those from USGS in the US. A good source for other countries, though, is OpenStreetMap. We'll explain how to use it in WorldEditor to map airports.

OSMAirportsX

There is a (python)tool called OSMAirportsX that can convert from OSM to apt.dat.


Getting the map

It all starts with getting a zoomed, "mega tile" of the airport from OSM. BigMap 2 will help us in this. This service lets you specify a zoom and an area, and provides you with a script that, once run, will give you a single PNG file of the area.

Error creating thumbnail: File missing
BigMap 2 over LIPR

Clicking "submit" you get to a preview where you can tune both the zoom and the selected area. It's not really comfortable but can be worked out.

Adjusting BigMap area

When you're done, download the OZI file and the Perl script (I guess the Python one is fine too). The Perl script needs GD (libgd-perl on Debian) and LWP (should be in libwww-perl, might be preinstalled). WARNING: it prints to STDOUT, so be sure to redirect it! If you don't, you'll have wasted all the time spent downloading the tiles (they're not cached):

$ ./bigmap.pl > myHugeMap.png

Preparing the map

When it's done, you might consider for the health of your eyes to correct the contrast of the grass parts, that in OSM Mapnik is a bit bad, with some tool like GIMP. While you're at it, also consider deleting the parts that you don't need, to ease future loading and manipulation.

Getting the coordinates

Georeferencing something can be a terrible experience, especially if it's a scanned map with unknown projection. With OSM tiles though it's all a lot easier, because of their digital precision: there's no distortion, and you perfectly know the coordinates of the edges. (note: actually I don't know if they use the same projection, I couldn't find what WED uses, but so far - and I admit it's not a long distance - it seems there's no problem.)

We do know those coordinates because they're in the OZI georeferencing file we downloaded (should be bigmap.map). To testify the precision of the PNG we have, only two points are needed to know all the other coordinates:

...
Point01,xy,    0,    0,in, deg,  44,1.93924,N,  12,35.41992,E, grid,   ,           ,           ,N
Point02,xy, 8191, 7167,in, deg,  44,0.28015,N,  12,38.05664,E, grid,   ,           ,           ,N
...

The first is top left, the second is bottom right. We'll have to convert these coordinates, because WED accepts a decimal format (XX.XXXX°), and this is degrees and minutes (XX° XX.XXXXX'). There are many services online for this kind of conversions, one is at this link. You can find others by searching for "degrees minutes decimal converter" or with similar queries. An example of usage of the above would be typing in the top form fields "44", "1.93924", "0" and getting "44.032321".

Georeferencing the map in WED

Now the best part. Open WED and your airport, then go to menu View > Pick overlay image... and choose your huge map. Select top left vertex of the overlay image and paste the decimal coordinates to the proper fields. See the third picture if in trouble.

Error creating thumbnail: File missing
Entering the coordinates for the vertices

You have probably noticed that that converter gave us only 6 decimals. WED accepts 3 more of them. Is this loss of accuracy? Well, 0.000001° in latitude corresponds to about 11 cm. Considering that the OSM data was probably generated from orthophotos with a resolution of half a meter per pixel, this shouldn't be a problem at all. So safely repeat the procedure accordingly for the other 3 vertices, and slowly see how everything goes to its place.

When done it should fit like a glove

Remarks

  • The runway should coincide with that from the *.dat file. If it doesn't, be sure to check what's wrong, as moving runways shouldn't be taken lightly.
  • OSM doesn't have Bezier curves, so you should check by other means which curves, corners and intersections should be rounded. A trick could be making them stand out in OSM by mapping them with more points (hence resulting rounder).
  • In OSM, taxiways are mapped as linear features. So the trick to get their real shape is to map grass areas.
  • If you learn how to map airports in OSM, you'd kill two birds with one stone: help OSM and help FG.
  • OSM mappers can trace over Bing and Yahoo aerial images, so they can get quite accurate.