Board index FlightGear Development Scenery

[HOWTO] Perfectly georeferenced OSM airport maps in WED

Questions and discussion about enhancing and populating the FlightGear world.

[HOWTO] Perfectly georeferenced OSM airport maps in WED

Postby bigstones » Fri Apr 25, 2014 10:14 pm

NOTE: I have put this howto in the wiki:
Please refer to that, as the following might be outdated.
I'm an OSM contributor and in FG scenery there's a lot of Italian airports that need an 850 layout. I've already done that for LIPY and I'm just doing it for LIPR too, but this time I looked for a more intelligent way to overlay the airport map, than stitching together browser screenshots and then fighting to make them follow the runway from apt.dat (which in general shouldn't be moved, and seem to be precise enough). I was so happy with the improvement that I decided to post this howto.

It all starts with getting a zoomed, "mega tile" of the airport from OSM:
The above 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. Here's LIPR.

When you click "submit" you get to a preview where you can tune both the zoom and the selected area. It's not really comfy but I'm sure you can figure it out as much as me.

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 (not sure, I think it's libwww-perl). 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):
Code: Select all
$ ./ > myHugeMap.png

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.

If you've ever georeferenced something, you know what a hellish thing is. As an excursionist, I've done that with scanned maps (with unknown projection) and trust me it is. 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 To testify the precision of the PNG we have, only two points are needed to know all the other coordinates:
Code: Select all
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 XX.XXXX° format, and this is XX° XX.XXX'. I used this service, but there are many:
Example: type in the top form fields "44", "1.93924", "0" and you'll get "44.032321".

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:

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 11cm. 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...

Now remember that OSM doesn't have Bezier curves, so check on Google Maps by other legal means how you should round the intersections (an option is mapping curves with more points in OSM). One last note for OSM mappers: in OSM, taxiways are mapped as linear features. So the trick to get their real shape is to map grass areas.

Ok, now please don't tell me there's already a way to import airports directly from OSM data... :D

Oh and one note to NIATCA guys: I saw you recently added LIPR to your ATC network, so please let me know if you're already making the layout for this airport.
Last edited by bigstones on Tue Apr 29, 2014 1:45 pm, edited 1 time in total.
Posts: 95
Joined: Sat Apr 05, 2014 11:09 pm
Location: Italy
Callsign: I-NOOB
OS: Debian testing

Re: [HOWTO] Perfectly georeferenced OSM airport maps in WED

Postby f-ojac » Sat Apr 26, 2014 6:50 am

Very nice indeed!
Hosting terrasync, World Scenery, TGWeb on my own private server. Click here to donate and help to make the service last.
Posts: 1290
Joined: Fri Mar 07, 2008 9:50 am
Version: GIT
OS: GNU/Linux

Re: [HOWTO] Perfectly georeferenced OSM airport maps in WED

Postby elgaton » Sat Apr 26, 2014 9:29 am

Thanks for the tips - until now I manually downloaded the overlay images from OSM and positioned them by comparing the OSM runway coordinates with the overlay, this will greatly improve the accuracy of future airports.

bigstones wrote in Fri Apr 25, 2014 10:14 pm:Ok, now please don't tell me there's already a way to import airports directly from OSM data... :D

Sorry, there is one :) - it's called OSMAirportsX. Basically, it's a set of Python scripts that fetches data from OSM and OurAirports and automatically generates the apt.dat file for the aerodrome you want. Be warned, though - the tool creates only a first sketch and manual tweaking is almost always required: for example, since (as you correctly noted) in OSM taxiways are mapped as linear features and not as areas, OSMAirportsX just renders them with a fixed width you specify in the tool itself - that does not correspond to reality for most airports; taxiway centerlines need to be adjusted in case you want to model how they intersect as well (in some airports one of them is sometimes interrupted to discriminate between regular taxi routes and secondary taxi routes, preventing aircrafts from going the wrong way); stop bars are not rendered; OSM data may not be totally accurate or even complete; and so on.

Your best bet would be to use OSMAirportsX and to check the results against satellite imagery; if it's quite accurate you could start from there, otherwise I advise starting from scratch (as I did with LIPX since the result generated by OSMAirportX did not please me enough).

(Another tip: since you're an OSM contributor, the Italian Environment Ministry has licensed satellite imagery for use in OpenStreetMap. It is accessible with any WMS client like Merkaartor, configuration details are on this OSM Wiki page, so you could download existing OSM data and imagery, trace them/adjust them if needed, upload them to OSM and then use the data in WED).

bigstones wrote in Fri Apr 25, 2014 10:14 pm:Oh and one note to NIATCA guys: I saw you recently added LIPR to your ATC network, so please let me know if you're already making the layout for this airport.

Not at the moment - after LIPX is done (which will take time since I still need to finish positioning the taxiway markings, adding buildings and ground signs...) I plan to improve LIMC and the Aviano Air Force Base. In any case I list all ongoing/completed work in the Airports under construction wiki page, so you can just check there to see if I'm working on an airport or not.

Thanks for your work and keep contributing - we really need more properly done 850 airport layouts!
NIATCA 2nd admin, regular ATC at LIPX and creator of the LIPX custom scenery
Posts: 1107
Joined: Tue Mar 19, 2013 4:58 pm
Callsign: I-ELGA/LIPX_TW
Version: Git
OS: Windows + Arch Linux

Return to Scenery

Who is online

Users browsing this forum: Grumpysanta and 2 guests