FlightGear is a cross-platform open-source flight simulator. The simulation has been constantly improved on by a number of different people from all over the world. While I do not know the exact nature of its popularity, the fact it is free and a very good flight simulator makes it a viable alternative to commercial flight simulation products.
Users have contributed a large number of aircraft, source code and other resources to make FlightGear a quality product, but there is one area where it lags behind the competitors despite the best interests of several people: scenery.
FlightGear's scenery is not bad. However, there are limitations with the current scenery set.
First, the worldwide vmap0 coverage does a reasonable job of representing each square foot of the Earth, but it is woefully unaccurate in places (such as coastlines) and does not have a high level of detail. Second, these inaccuracies can become quite obvious when buildings are placed in their real-life locations - it is possible for buildings to 'float' on water when in reality they are in their precise location. Third, there are only a limited of number of landclasses available to use in the scenery due to the amount of GPL-available photo textures users have created for this. (A landclass is the type of land use a certain point on the Earth's surface is defined as in the simulation, for instance a city or forest landclass.) Finally, it is difficult to create new scenery for FlightGear, though this manual is designed to make the scenery creation process more accessible to those interested in modifying and creating more than just buildings.
While other flight simulation products have spawned entire communities driven toward generating better scenery, creating new areas to fly around in FlightGear has been limited to the efforts of few (yet talented) people.
This article is being written in order to explain how to create custom FlightGear scenery using heads-up digitizing.
Scenery already created using the heads up digitization method and integrated into the FlightGear Scenery Database include parts of the Caribbean around St. Maarten, and Helgoland, off the coast of Germany.
Table of Contents
- Approaches to Scenery Generation
- The FlightGear Scenery Structure
- The FlightGear Scenery Database
- Creating Hand-Drawn Scenery using satellite imagery
- Obtaining GIS Software
- Obtaining a Satellite Image
- Digitizing Scenery: A Step-by-Step Process
- Merging the Custom Data
- Digitizing and Merging Line Data: Roads, Railroads, Rivers
- Digitizing Tips and Tricks
- Compiling Your Scenery
Approaches to Scenery Generation
The following section is designed to help those coming from a background in Microsoft Flight Simulator understand the FlightGear scenery structure.
FlightGear uses vector-on-vector data to display ground-based scenery. This is different than systems used in Microsoft Flight Simulator, which is mostly a vector-on-raster system. Both systems have their advantages and disadvantages.
The phrase vector-on-vector means that vector road and river (and other) data is overlaid on top of other vector data - in short, the ground layer is derived from vector data. This can be very powerful, considering that vector data has greater accuracy than raster data. For instance, a park in FlightGear could be defined as the actual boundaries of the park as it appears in real life. Also, vector data does not take up much space - large areas of Earth with the same landclass can be represented very efficiently.
However, vector data is not perfect. Because of elevation triangulation procedures, flying in areas with a lot of vectors can be costly on performance. Also, FlightGear currently lacks seam blending, leading to harsh edges between land use patterns. While raster data can have the same problems with edges, raster data can be textured in a way to eliminate harsh edges.
The difference between the two is that a landclass in Microsoft Flight Simulator behaves differently than a landclass in FlightGear. Microsoft's landclass is raster-based, meaning it's on a grid system - while this looks prettier, it's also more obvious it's on a grid system, and the overall result is less accurate. Therefore, changing a landclass value in MSFS is as easy as changing the raster cell number at a particular location. MSFS also allows for polygonal vector data to be overlaid on top of the raster data when precision is an issue.
Editing vector data, on the other hand, requires digitization. For instance, imagine a city in FlightGear whose urban footprint is too small. In order to correctly position the city, you will have to open up GIS software, draw an outline around the city limits, remove data which was underneath, and recompile. However, the end result is geographically more accurate.
The FlightGear format also allows the download of scenery in degree by degree chunks. Therefore, the user will not waste disk space on parts of the world over which they will never fly. (For instance, the remote, large and uninhabited Kerguelen Island in the Southern Indian ocean is likely on the hard disks of only a few FlightGear users, but it comes packaged with MSFS.)
The FlightGear Scenery Grid Structure
FlightGear recognizes scenery in chunks of degrees. The scenery is first organized by the nearest tens of degrees, rounded to the north and west. For instance, terrain data for Phoenix, Arizona, at W112 N33, can be found in the Scenery/Terrain/w120n30/w112n33 : any terrain to the south and east of W120 N30 but north and west of W110 N20 can be found in a subfolder of w120n30.
As a result, the area of scenery generation is largely dependent on the degree grid. For instance, the general rule of thumb is that you cannot generate a block of scenery smaller than 1/4 by 1/4 of a degree of scenery (though there are exceptions; 1/8th a degree is the absolute smallest, and at higher latitudes scenery generation may be as large as a full degree).
For instance, when first experimenting with this type of scenery creation, the island of St. Kitts was completely hand digitized; the neighboring island of Nevis was not (though it since has been). As a result, the northern part of Nevis was truncated, and while the separately generated runway appeared, the rest of the Nevis north of the 1/4 degree line appeared as ocean. This scenery block was therefore incomplete until the island of Nevis was digitized and committed to the database.
There are two important things to take away from this degree-based terrain structure.
First, remote islands are easier to insert into the database than continental areas. Here, 'remote' means that the 1/4 by 1/4 degree area the island resides in (or larger) is completely surrounded by water. Since ocean is the base layer, no merging or intensive GIS work is necessary to merge the hand-made file with the rest of the scenery file. As a result, you can easily add completed 'remote' islands into the scenery database.
Note that if there is an island which would take up two or more 1/4 by 1/4 cells, each of those cells would need to be completely surrounded by water for the island to be considered 'remote'.
Second, you need to generate custom scenery in 1/4 by 1/4 degree blocks or more. For instance, you cannot just digitize a lake and insert it into the FlightGear scenery; you have to generate the area around the lake as well, even if you haven't digitized it. This requires you to merge the shapefile into the scenery database.
The FlightGear Scenery Database
Creating Hand-Drawn Scenery using satellite imagery
Those familiar with integrated Global Information Systems (iGIS) will recognize this as a form of heads up digitizing.
Here are the ingredients to creating scenery:
- Geographic Information System (GIS) Software
- Satellite imagery
- Disk space - at least one GB free recommended
Obtaining GIS Software
Currently, you will need Global Information System software in order to create FlightGear scenery. I consider this to be one of the problems with the current state of FlightGear scenery, as the learning curve may put off potential scenery creators, but the software is very powerful and gets the job done.
GIS isn't easy. There's a learning curve involved, so if you've never used mapping software before, try and find a good tutorial online just to familiarize yourself. For this project, I highly recommend Quantum GIS (QGIS); it is open source, cross-platform and lets you easily create your scenery product. In this tutorial, I will be using QGIS with the GRASS plug-in, though there are other products out there which will get the job done just as well.
Obtaining a Satellite Image
First, you need a good satellite image to work from.
You can obtain satellite imagery thru the Earth Science Data Interface (ESDI) server. Click 'map search' and select the checkbox next to ETM+. Zoom in on the map to the area which you would like to download. Once you're zoomed in enough, the mouse cursor with the + sign lets you select the data you want to download.
FlightGear scenery creators should almost always digitize off Landsat data. While the data is older and has a lower resolution than would be preferable, it is nicely orthorectified (ie in the correct location) and the copyright on the files is free. Do not use commercial imagery such as Google Earth - it is proprietary, and we will not be able to include your scenery in the world database since you do not have the right to digitize and distribute!
Preview the data. You want to make sure the data is ETM+ data and in the GeoTiff format. Then, click 'download'.
This does not actually let you download the data - it brings you to a selection screen. First, make sure the area looks correct by selecting a file ending in browse.jpg. If this looks like the area you're interested in, you're golden; if not, double-check again. (Usually bodies of water can prove beneficial in determining if the tile is good or not.)
Then, download the file ending in _nn80.tif.gz. This is the only file you will need to download for that section of Earth.
This file is the panchromatic (black and white) band of the Landsat Satellite's Enhanced Thematic Mapper. The other files are at different color bands and are used in a wide variety of scientific applications, but we don't need them. Though our panchromatic image is black-and-white, it is at 15 meter resolution and the color bands are at 30 meter resolution, meaning the ground imagery is clearer with the black-and-white image.
Check your email or make a cup of tea - these files are large and can take awhile to download. Once you're done, create a scenery directory and unpack the TIFF to this directory. You now have your image and can begin digitizing.
For this tutorial, the island of Santa Catalina, to the south of Los Angeles will be used as an example. You may wish to use this as a tutorial exercise though this area will already have been submitted to the repository.
Digitizing Scenery - a step-by-step process
- Open QGIS. Create a new project (if one is loaded).
- Select Add Raster Layer from the Layer menu. Find the image you downloaded and select it.
- The image should be displayed on your screen. To begin digitizing, however, we need to create a new vector layer.
- Select New Vector Layer from the Layer menu. A dialog box should display.
|Creating a correct vector layer|
- Make sure the file type is an ESRI Shapefile.
- Make sure the vector type is set to polygon.
- You need to create a data column for this layer. Create a column called 'class'. Make sure it is a string column. Add it to the attribute list by selecting the Add Values Manually button. The 'OK' button should now be available for you to select. Select 'OK'.
- There should be a dialog box prompting you to save your vector layer. Save it in your scenery directory with your GeoTIFF. (This is not required but significantly helps organization.)
- A projection box should pop up. Select 'WGS 1984'. After all, that is the globe model used in FlightGear.
- Your vector layer should appear in the left-hand toolbar. You are ready to begin digitizing.
- Zoom in on the area you will be digitizing. Then, select the digitization button - this looks like a pen - from the toolbar. Now, select "Capture Polygon" from the same toolbar. Your mouse will turn into a little target.
- Now, to select the area we want to digitize first. There is a little lake on the map - in the southern middle part of the island. Let's try digitizing the lake first.
|You should start your digitizing by selecting obvious landmarks, such as a lake, a city, or a beach which is well known to you. It doesn't matter which feature you digitize first. For instance, with St Maarten the coastal portion was digitized first and then the inland areas; St Kitts was digitized in a clockwise pattern around the north part of the island. However, by digitizing familiar areas first, you provide yourself a reference point for other, unfamiliar areas.|
- With your mouse, left-click on a point at the northernmost edge of the lake.
- We now want to trace the outline the lake. Move your mouse to another point to the right of the first point and click it again. Your mouse should show a red line. The points should not be redundant - for instance, as long as the line between two points is straight, there is no need for another point in between the two.
|The lake, after three points have been digitized. From here, continue in a clockwise manner. It does not matter if you digitize clockwise or counterclockwise.|
- You will want to digitize features in a circular manner to avoid problems. You can always go back and add points later. With this in mind, move your mouse to a third point on the lake to the right of the first two points. A small triangle should form, representing the polygon which would result if you decided you were done with the polygon.
- Continue outlining the lake by clicking along its shoreline, initially moving to the right. When you are on your last point, instead of left-clicking, right-click. QGIS will finish the polygon.
|What our finished lake should look like.|
|A note on accuracy - you want to be as accurate as possible, but you also want to use as few points as possible. Using more points wastes time and disk space. Don't let this discourage you from creating an accurate lake - just don't create a point for each pixel of satellite image, you don't need to do that!|
- A dialog box will pop up, asking you to type in the value for 'class'. Since this is a lake, type in 'lake'. This step is important - it is how you know what each polygon should be mapped to in our finished scenery.
- We have finished our first polygon, but we need to fill the entire island. Digitize the grassy area to the north of the lake. We know it is a grassy area because it is colored differently than the surrounding area. In the picture above, the grass is the lighter grey area. If this is your first time digitizing off of satellite images, it may be difficult for you to identify different land use patterns. In this case, you may want to get an idea of what the feature is from newer, commercial, aerial photographs which you may be able to find online.
|Since the level of detail in the satellite image is relatively low, it can be hard to identify features. The temptation to bring in commercial imagery and digitize is likely strong because it can be difficult to make out the features. Feature identification becomes easier over time as you get used to looking at the images.|
- With your mouse, trace the outline of the grassy area. Right-click your last point into place and tell the pop-up box that this area is "grass". It should not have touched the lake - we could run into problems if snapping isn't set!
|Just before right-clicking to finish our grass polygon.|
- If you haven't done anything to turn snapping on, now is the time to do so. Go to Edit Menu -> Options. A tabbed dialog box should pop up. Go to the Digitizing pane.
- Since we are working in UTM co-ordinates, make sure your snapping size is around 20 or so. With latitude and longitude you want to reduce it to a very small number, say .00001. I forget what I use for the Lat/Long, so experiment to see what works.
- Turning snapping on is important. We don't want small holes in our scenery, nor do we want overlapping polygons. Snapping adjusts each point as you go by - you will miss occasionally and have to correct it - so you don't have to worry about lining the polygons up precisely.
Distinguishing Land Class Types from LANDSAT data
For people who have not worked with satellite imagery before, it may be difficult to figure out what certain areas of land are. Here's a list which may help you:
- Water is usually always black or very close to being black. However, shadows from clouds can also appear black on your image. If your image has clouds, use caution!
- Forests are also dark grey.
- Scrub Cover is like a forest, but lighter in color since the forest consists of shrubs, not trees.
- Crops can be a wide variety of different colors, but are easily distinguishable by their field-like patterns. You have your choice between dry crops, mixed crops and irrigated crops - take a look at the corresponding texture to figure out which crop style best suits your area.
- Golf Courses should be digitized as a class even though we do not have a texture for them yet. They should be conspicuous by their pattern and their bright pixels.
- Urban Areas should have some semblance of a pattern to them. Pixels can vary from darkness to lightness.
- Towns are much smaller than urban areas and you may not be able to pick up any distinct patterns.
- Industrial Areas should be digitized if you know where the areas are. They are usually characterized by large, boxy buildings on the outskirts of urban areas, though this obviously varies by city!
Merging the custom data
Merging the data is a time-consuming process. This tutorial assumes you have not digitized the entire underlying area but have instead digitized parts of the underlying area and are merging it with the default scenery. The following section outlines the steps you need to take using your GIS Software in order to create land-based (not island) scenery. A QGIS/GRASS tutorial is forthcoming.
- Determine the bounds of where you are working. These should be no more than about 3 degrees by 3 degrees and likely smaller. For instance, the work area for the initial London landclass was W1-E1 N51-52, or only two square degrees.
- Using the bounds, download all the vmap0 shapefiles from http://mapserver.flightgear.org. You can only download one layer at a time, but you will need to download all landclass related files which appear in your work area. Files less than about 200kB usually do not contain any spatially referenced data. You don't need road, river, or railroad data unless you have digitized one or more of those features. You also don't need landmass or elevation data. Empty spaces in your scenery are assumed to be ocean.
- Clip your vmap0 data to your work area. The vmap0 data is not clipped to the boundaries, but instead gives you all the areas which appear in the area you requested. Therefore, if a large forest just breaches your work area, you will get the entire large forest. Clipping will cut those areas out, leaving you just with the scenery area you are interested in. (Note to GRASS users: you need to import all of the files into your region and mapset before you can clip.)
- Now you will need to assign a landclass type to your vmap0 data. Add a column called 'class' to each polygonal shapefile you are working with and fill it with the feature type - for instance, v0_lake would have the word 'lake' in the class column for each lake in the work area. You will usually need a database program to complete this task.
- Our next goal is to create a single shapefile from all the shapefiles we have downloaded. Begin merging the vmap0 data together by merging. For GRASS users, the module is v.?. You will likely have several 'intermediate' shapefiles which you can safely remove once you are done with the process.
- Check the new shapefile's attribute table for landclass information. Likely, the dissolves will have placed these in separate columns - you will need to normalize this information to get one single landclass data column using database functions. You will also want to concatenate the columns because some dissolved polygons may unfortunately contain more than one value (for instance, crops AND lake).
- Clean the vmap0 data. For instance, if there are any unclassified areas which are not ocean, you will need to assign them with landclass information (GRASS users can just drop in a centroid). Here is a list of what to look for:
Alternatively, you could clip the polygons against each other before dissolving, though this may introduce error if done incorrectly.
- Very small areas in between merged polygons which did not get classified as anything. Unfortunately, these seem to exist in large numbers. They need to be removed, but GRASS users can just drop in a (very finely placed) centroid and run a post-clean dissolve.
- Areas with more than one class designation. For instance, some of the crop layer may be merged with some of the lake layer - you will need to make a decision on which class more accurately describes that polygon and change it.
- Polygon overlap problems - similar to areas with more than one class designation, but these are very small areas where the polygons weren't clipped correctly.
- If your area has a coastline, double-check these areas since a new coastline will likely be generated based on your data.
- If you have not done so already, you need to convert your custom layer from Universal Transverse Mercator (UTM) into Latitude and Longitude (Lat/Long). Otherwise, you can't merge!
- Import your custom shapefile. Clip the vmap0 shapefile using a NOT vector union (vector subtraction). This will cut holes in the vmap0 file where you have created your custom scenery.
- Do another vector union between the clipped vmap0 file and your custom scenery. Use the AND operator. This will insert your custom scenery into the holes in the vmap0 shapefile.
- Do a final clean-up. As you will see, it is helpful to have your custom scenery overlaid on top of the completed, merged scenery layer. Here are things to look for:
- Coastline problems. If you have digitized near a coastal area, check to make sure there are no 'dead zones' between the coast and the default data. Also check to make sure the default data does not extend further into the ocean than your custom scenery.
- Lake problems. If you have digitized a lake, but have not digitized the area around the lake, you will need to reclassify the vmap0 lake layer as the surrounding scenery.
- Other problems. Make sure everything looks correct in areas where you have only partially digitized.
- Naming conventions. Check to make sure everything is named properly and that there are no typos in the 'class' column, or else there will be holes in your scenery.
- Finally, you will want to extract each individual layer and save it as its own shapefile. For instance, your end product is not your merged shapefile but rather a group of shapefiles named mixedforest.shp, drycrop.shp, lake.shp. This is so you may compile your finished product using TerraGear. Use an extract feature on the all-important 'class' column.
- You are ready to compile!
Digitizing and Merging Line Data: Roads, Rivers, Railroads
Digitizing roads, rivers and railroads is exactly the same as digitizing polygons - you click at each point on the map where the road, river or railroad exists. Instead of closing a polygon to finish digitizing, however, you merely end the line.
Please note that if you are digitizing from LANDSAT, you will have to convert from UTM to Latitude/Longitude (unless you converted your Landsat image to Lat/Lon before you started working).
There are advantages to creating just line data. For one, you can improve the scenery without having to mess with any polygon merges, and large areas or areas with islands can easily be dropped into the scenery database.
However, there is one important thing to note about merging line data into the scenery database - continuity. If you are digitizing say only a 1/4 degree by 1/4 degree around your hometown, which say is in the middle of the continent, your river and road layers may be completely accurate for that 1/4 by 1/4 area but the roads and rivers around your work area will not be accurate. As a result, there are two possible outcomes. You can either have a discontinuity - where accurate and inaccurate roads and rivers stop at the boundary of the area. This boundary will likely be very visible to someone flying over your scenery as the road they may have been using to fly to the local airport VFR suddenly stops and re-starts 100 meters north without any warning!
The other option is to merge the data in by having your last portion of line data next to the boundary meet up with the vmap0 data. This is good for continuity purposes, but is bad for accuracy purposes - as the area near the boundary of your scenery area will be inaccurate as it 'meets' the vmap0 data.
The end result may be a balance in between the two, where you digitize an accurate shapefile and then edit the vmap0 data outside the boundary to meet up with your accurate road/river data - however this involves a little more work on your part because you will have to download a larger area of roads than your scenery work area, delete the default vmap0 roads inside your scenery area using GIS functions, insert the accurate roads, then move vertices of the vmap0 lines to match up with your line data.
Digitizing Tips and Tricks
The following tips and tricks are for QGIS and GRASS users, though users of other programs may find them helpful.
You can change the color of the shapefile by clicking on it in the left display toolbar. It usually is a good idea to set the transparency of the layer you are digitizing to between 50 and 75 percent so you can still see what you have digitized underneath the polygon. This can help you fix errors as they are introduced.
If you have a large feature to digitize, such as a forest, you don't have to digitize all of it at one time! Instead, you can create small polygons labeled as 'forest' next to each other, and this works the same as one giant polygon.
If there is a lake in the middle of a forest you have already digitized, you can use the QGIS ring feature to cut a hole in the polygon. You can then fill in the hole by creating another polygon.
If you have a large number of polygons which is taking awhile to render, set the number in the Options->Render window to 0 from 1.
GRASS users should be aware that if there is a large area of one land type with a large number of points to connect, it is easier to not fill the polygon in in QGIS! When you start the merging process, simply digitize a centroid into the area and label it accordingly. This saves time.
Compiling your Scenery
You will need a working copy of TerraGear.
In order to compile correctly, you need to extract each land use type from your main shapefile and make it its own shapefile (GRASS users should use the module v.extract). For instance, you need to take all the lake layers in your shapefile and make a shapefile with only lake layers.
This document was created by John Holden in 2009. All Rights Reserved.