Aligning satellite images with airports.


This is a bit complicated but it works very well.
Check out the images of Philadelphia International at the bottom of this page.

I picked 2 points at PHL in Fly! to get lat./lon., one point at the southwest corner of runway 9R, and one point at the northwest corner of 17.  The image I put together from terraserver images was about .5 x .5 degrees (30x30 minutes).  For larger images it probably would be best to find 2 airports and pick one point at each.

OK, once you've got your satellite image ready to import into the editor load Fly! and slew to a large airport, slew to a spot on a runway that you can pinpoint on your satellite image and press tab twice.  Read the latitude and longitude in the upper left corner of the screen.  Do this again with another point as far away as you can get from the first point. Pick 2 points that are as far from each other as possible since you probably are not going to be able to find the location perfectly on the sat. image (unless you are using 1m resolution). The error introduced will be lower the farther apart the 2 points are. Also the 2 points should be far apart in both x and y, if you're using one airport sometimes this requires using 3 points to get the best values for degrees/pixel in both x and y. To use 3 points you just use the latitude and y from one pair and longitude and x from another pair (example: use x,y:lon,lat from point 1, x:lon from point 2, and y:lat from point 3)

Now load your satellite image into your favorite graphics editor and find the 2 or 3 points you picked when you were in Fly!.  Read the X,Y coordinates in pixels from the image, also read the size of your image in pixels.

Don't forget that latitude is y and longitude is x, if you're used to writing coordinates as lat, lon, this can easily lead to confusion. (particularly if you haven't slept in a few days :-)


Here is a MS Excel 97 spreadsheet to do the calculations.

Here is a page with the algorithm explained with variables.

Now for the math, I'll use my PHL data as an example:

My 2 coordinates in Fly!:

(a) 39° 51' 38.358N = 39.860655
(b) 75 16 30.5244W = 75.275146

(c) 39 53 09.7570N = 39.886044
(d) 75 14 06.1001W = 75.235028

To convert DMS to decimal use deg + min/60 + sec/3600

My 2 (x,y) coordinates in the satellite image:

(e) 1671,  (f) 1430
(g) 1885, (h) 1255

The image size = (i) 3584, (j) 3000

My delta x (Lon.) in degrees is (k) 0.040118 (75.275146- 75.235028)(b-d)
My delta x in pixels is (l) 214 (1885-1671)(g-e)
My delta y (Lat.) in degrees is (m) 0.025389 (39.886044-39.860655)(c-a)
My delta y in pixels is (n) 175 (1430-1255)(f-h)

Now pick one of the points used above to use as a reference to calculate the corners for the input file for the editor.

For an image size of 3584x3000 the distance from the point I used (1671, 1430) to each side of the image is:

(e) 1671 and (i-e) 1913 in x
(f) 1430 and (j-f) 1570 in y

For y:

39.860655 + 0.025389*1430/175 = 40.068119   a+m*f/n
39.860655 - 0.025389*1570/175 = 39.632879    a-m*(j-f)/n

For x:

75.275146 + 0.040118*1671/214 = 75.588404    b+k*e/l
75.275146 - 0.040118*1913/214 = 74.916521     b-k*(i-e)/l

So the upper right corner for the input file is: 40.068119N 74.916521W
And the lower left corner for the input file is: 39.632879N 75.588404W

For other areas of the world:
For W longitude the larger number is the left side.
For E longitude the smaller number is the left side
For N latitude the larger number is the upper side.
for S latitude the smaller number is the upper side.

It looks like the editor needs the N E S W after the lat/lon but it doesn't use it, it also seems to assume you are using N and W, so for E and S you have to add a minus (-) sign. Looks normal for S but backwards for E.

Now fire up the editor an add the scenery.

In the editor make sure you use "goto" the airport or lat/lon you used before trying to slice, this puts you in the global tile where the new scenery will be added.  Or if you know the coordinates you could manually enter the global x,y tile when you enter the input text file. Also the image has to be large enough and positioned to cover all of at least one normal tile, which is the size of the white box in the editor. If your scenery crosses the boundry of a global tile you will need to move to that tile and add the scenery using the same text file. If you slew around the edges of the scenery you are adding while watching the global x,y you can see if your scenery ends when the x,y changes, if you were expecting more scenery to show, stop and add the scenery for that global tile.

If you don't have a data folder in your main Fly! folder you need to make one before running the editor or you will get "access violation" errors when adding scenery.
 

A scaled down version of the sat. image I used, the white box is about where the above image is:


 

For the images I use terraserver (terraserver.microsoft.com). How I do it is to set my screen color to 32 bit, put the area I want in terraserver and then use the area capture feature in Paint Shop Pro and save each section as an uncompressed tga file. I then use the arrows in terraserver to move around and capture more sections. It helps to make a grid on paper and mark off where you've been and what file name you used for each section. I then stitch all the sections together. With my method of calculating the corners of the image I don't bother saving the terraserver coordinates now.

I used this method to add 2 small areas, Wilmington DE to the southwest and northeast philly (to the northeast). and they lined up perfectly with the airports (ILG and PNE) and the edges of the new scenery also lined up perfectly with the philly scenery tile above.

Note: If you have altered the texture count settings in your .vcf file for your video card, you could have problems with custom scenery. I had mine altered and was getting low frame rates and texture tiles moving around on the land. Setting the texture count settings back to the original values fixed it.

Back to the index.

9/24/99  Marty Schultz