Howto:Create custom terrain: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
No edit summary
m (Robot: Cosmetic changes)
Line 5: Line 5:
Your goal for editing area data is to create a shapefile of a seamless layer of polygons which correspond to some type of land cover. This data is then fed into the mapserver and, possibly, TerraGear to create new scenery.
Your goal for editing area data is to create a shapefile of a seamless layer of polygons which correspond to some type of land cover. This data is then fed into the mapserver and, possibly, TerraGear to create new scenery.


===Evaluating the current data===
=== Evaluating the current data ===
Before you begin, please make sure the area you want to improve doesn't already have good coverage. Just because it looks bad in FlightGear does not mean the area has not been improved. For this, you will need to check the Flightgear Mapserver, at [http://mapserver.flightgear.org/ mapserver.flightgear.org].
Before you begin, please make sure the area you want to improve doesn't already have good coverage. Just because it looks bad in FlightGear does not mean the area has not been improved. For this, you will need to check the Flightgear Mapserver, at [http://mapserver.flightgear.org/ mapserver.flightgear.org].


Let's take a look at the Finistère in Brittany, Western France: if you click [http://mapserver.flightgear.org/map/?lon=-4.41840585539649&lat=48.4484146908477&zoom=11&layers=0B000000FTTFFFFFTFT here], you will quickly see and understand how the Finistère county is known of [[FlightGear]]. Some towns/cities (red), a few forests (green), etc. Overall, it is not a very good resolution: a lot of angles, the detail level is not that good, some towns are missing. If you want a better definition on ground, there is some work to be done! The goal being to obtain something like this:
Let's take a look at the Finistère in Brittany, Western France: if you click [http://mapserver.flightgear.org/map/?lon=-4.41840585539649&lat=48.4484146908477&zoom=11&layers=0B000000FTTFFFFFTFT here], you will quickly see and understand how the Finistère county is known of [[FlightGear]]. Some towns/cities (red), a few forests (green), etc. Overall, it is not a very good resolution: a lot of angles, the detail level is not that good, some towns are missing. If you want a better definition on ground, there is some work to be done! The goal being to obtain something like this:


#[http://mapserver.flightgear.org/map/?lon=13.40385&lat=52.50199&zoom=11&layers=000000BFFFFFFFFFTFFF Berlin]
# [http://mapserver.flightgear.org/map/?lon=13.40385&lat=52.50199&zoom=11&layers=000000BFFFFFFFFFTFFF Berlin]
#[http://mapserver.flightgear.org/map/?lon=9.40368&lat=47.63699&zoom=11&layers=B000000FFFFFFFFFTFFF Bodensee surroundings]
# [http://mapserver.flightgear.org/map/?lon=9.40368&lat=47.63699&zoom=11&layers=B000000FFFFFFFFFTFFF Bodensee surroundings]
#[http://mapserver.flightgear.org/map/?lon=-88.55704&lat=43.98436&zoom=11&layers=000000BFFFFFFFFFTFFF Oshkosh surroundings]
# [http://mapserver.flightgear.org/map/?lon=-88.55704&lat=43.98436&zoom=11&layers=000000BFFFFFFFFFTFFF Oshkosh surroundings]
#[http://mapserver.flightgear.org/map/?lon=-62.87648&lat=17.69865&zoom=10&layers=B000000FFFFFFFFFTFFF Carribs]
# [http://mapserver.flightgear.org/map/?lon=-62.87648&lat=17.69865&zoom=10&layers=B000000FFFFFFFFFTFFF Carribs]


You will immediately notice the improvement to the ground. When flying, the difference is huge. Moreover, this enables the autogeneration of cities, trees, farmland, and so on.
You will immediately notice the improvement to the ground. When flying, the difference is huge. Moreover, this enables the autogeneration of cities, trees, farmland, and so on.
Line 24: Line 24:
# Click ''Map Search''.
# Click ''Map Search''.
# Tick the ETM+ box (left column).
# Tick the ETM+ box (left column).
# Click on ''Update Map'' on the right bottom of the map.
# Click on ''Update Map'' on the right bottom of the map.
# Click on the ''Place'' tab on the upper side of the map, in order to do a search by place, or you can do a search by latitude/longitude.
# Click on the ''Place'' tab on the upper side of the map, in order to do a search by place, or you can do a search by latitude/longitude.
# In the Place field, type ''Amsterdam, Netherlands'' for instance.
# In the Place field, type ''Amsterdam, Netherlands'' for instance.
Line 56: Line 56:
#* A projection box should pop up. Select 'WGS 1984'. After all, that is the globe model used in FlightGear.  
#* 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.
# Your vector layer should appear in the left-hand toolbar. You are ready to begin digitizing.
#Select the newly created layer in the layer list, toggle editing (<tt>Layer > Toggle Editing</tt>) and finally select Capture Polygon from the same menu/toolbar.
# Select the newly created layer in the layer list, toggle editing (<tt>Layer > Toggle Editing</tt>) and finally select Capture Polygon from the same menu/toolbar.
# With your mouse, left-click on a point at the southwestern edge of the small island.
# With your mouse, left-click on a point at the southwestern edge of the small island.
# We now want to trace the outline of the island. Move your mouse to another point below 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.
# We now want to trace the outline of the island. Move your mouse to another point below 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.
Line 71: Line 71:
# Click OK to save the snapping options.
# Click OK to save the snapping options.


====Distinguishing Land Class Types from LANDSAT data====
==== Distinguishing Land Class Types from LANDSAT data ====
You may Google Maps or Yahoo Maps running alongside your program to see what is what on the black/white image, but most areas are recognizable without use of the software. If you need help determining what part of the black-and-white image, please currently refer to the [http://stattosoftware.com/flightgear/tutorial/index.html#distinguishing original Stattosoftware Scenery Tutorial]. Instead of determining in a single band image you can also combine different ETM+ bands in a RGB file. Some information about different band combinations can be found here [http://web.pdx.edu/~emch/ip1/bandcombinations.html].
You may Google Maps or Yahoo Maps running alongside your program to see what is what on the black/white image, but most areas are recognizable without use of the software. If you need help determining what part of the black-and-white image, please currently refer to the [http://stattosoftware.com/flightgear/tutorial/index.html#distinguishing original Stattosoftware Scenery Tutorial]. Instead of determining in a single band image you can also combine different ETM+ bands in a RGB file. Some information about different band combinations can be found here [http://web.pdx.edu/~emch/ip1/bandcombinations.html].


===Exporting the shapefile===
=== Exporting the shapefile ===
In order to turn the landclass into scenery we have to split it into seperate shapefiles for each landclass.  
In order to turn the landclass into scenery we have to split it into seperate shapefiles for each landclass.  


Line 97: Line 97:
If you want to see these shapefiles integrated into the Custom Scenery database you can contact papillon81 and statto (through IRC or Forum). Please be remembered that your data has to be derived from freely available (public domain) sources. Other material can not be integrated due to legal issues.
If you want to see these shapefiles integrated into the Custom Scenery database you can contact papillon81 and statto (through IRC or Forum). Please be remembered that your data has to be derived from freely available (public domain) sources. Other material can not be integrated due to legal issues.


===Generating scenery===
=== Generating scenery ===
Please continue with [[TerraGear]] to generate the landclass into useable scenery.
Please continue with [[TerraGear]] to generate the landclass into useable scenery.


Line 106: Line 106:
* [http://wiki.osgeo.org/wiki/LandcoverDB_CS_Detail OSGEO Wiki]
* [http://wiki.osgeo.org/wiki/LandcoverDB_CS_Detail OSGEO Wiki]


===Resources===
=== Resources ===
* [http://stattosoftware.com/flightgear/tutorial/index.html Tutorial by John Holden]
* [http://stattosoftware.com/flightgear/tutorial/index.html Tutorial by John Holden]
[[fr:Howto: Utilisé QGIS et images satellites]]


[[Category:Howto|Using QGIS and satellite pictures]]
[[Category:Howto|Using QGIS and satellite pictures]]
[[Category:Scenery enhancement|Using QGIS and satellite pictures]]
[[Category:Scenery enhancement|Using QGIS and satellite pictures]]
[[fr:Howto: Utilisé QGIS et images satellites]]

Revision as of 18:13, 8 March 2011

Custom terrain in FlightGear is currently generated through processing shapefiles with TerraGear. In order to add custom scenery to FlightGear, you must create a custom shapefile.

A "shapefile" is a proprietary spatial information format. You can edit them with almost every GIS package. QGIS is quite a good package for this type of project.

Your goal for editing area data is to create a shapefile of a seamless layer of polygons which correspond to some type of land cover. This data is then fed into the mapserver and, possibly, TerraGear to create new scenery.

Evaluating the current data

Before you begin, please make sure the area you want to improve doesn't already have good coverage. Just because it looks bad in FlightGear does not mean the area has not been improved. For this, you will need to check the Flightgear Mapserver, at mapserver.flightgear.org.

Let's take a look at the Finistère in Brittany, Western France: if you click here, you will quickly see and understand how the Finistère county is known of FlightGear. Some towns/cities (red), a few forests (green), etc. Overall, it is not a very good resolution: a lot of angles, the detail level is not that good, some towns are missing. If you want a better definition on ground, there is some work to be done! The goal being to obtain something like this:

  1. Berlin
  2. Bodensee surroundings
  3. Oshkosh surroundings
  4. Carribs

You will immediately notice the improvement to the ground. When flying, the difference is huge. Moreover, this enables the autogeneration of cities, trees, farmland, and so on.

Downloading the Landsat pictures

Landsat Map Search
Preview and download Landsat image

Browse to the Earth Science Data Interface interface (mirror) to grab your Landsat data.

  1. Click Map Search.
  2. Tick the ETM+ box (left column).
  3. Click on Update Map on the right bottom of the map.
  4. Click on the Place tab on the upper side of the map, in order to do a search by place, or you can do a search by latitude/longitude.
  5. In the Place field, type Amsterdam, Netherlands for instance.
  6. Now click the button with the mouse and the small + sign. This will allow you to select image tiles. Select all images that cover your area of interest, in our example this is just one image.
  7. Click on Preview and download. This bring you to a selection page were you can choose what image you want to download. It is likely that there are pictures available from different dates for your area. Picking the most recent one is best, for known reasons.
  8. Clicking the ID will not bring you directly to the download page, first you have to click the Download button.
  9. Download the _nn80.tif.gz file (if this is not available, try an older image). Note that Landsat images are separated in different bands. Band 1/2/3/4/5/7 have 30m/Pixel resolution while band 8 (_nn80.tif.gz) has 15 meters per pixel.
  10. Uncompress the .tif.gz files in the directory of your choice.

Working with QGIS

QGIS with the TIFF image.
Creating the class column.
Toggle editing.
Tracing the small island.
The finished small island polygon.

Using a GIS software gives you the opportunity to realize a full range of interesting operations: modification of map data, updates on the ground classification, etc.

  • QGIS Download for Linux/OSX/Windows [1]


The following is largely adapted from the original QGIS scenery tutorial, which you may find of use.

  1. Launch QGIS.
  2. Click on Layer > Add a Raster layer.
  3. Modify the filter to search for *.tif files.
  4. Add the TIFF file you have just downloaded.
  5. Click on Layer > Add a new vector layer or on the corresponding icon. A dialog should pop up.
    • 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.
  6. Your vector layer should appear in the left-hand toolbar. You are ready to begin digitizing.
  7. Select the newly created layer in the layer list, toggle editing (Layer > Toggle Editing) and finally select Capture Polygon from the same menu/toolbar.
  8. With your mouse, left-click on a point at the southwestern edge of the small island.
  9. We now want to trace the outline of the island. Move your mouse to another point below 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.
  10. 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 island. A small triangle should form, representing the polygon which would result if you decided you were done with the polygon.
  11. Continue outlining the island by clicking along its shoreline. When you are on your last point, instead of left-clicking, right-click. QGIS will finish the polygon.
  12. A dialog box will pop up, asking you to type in the value for 'class'. Since this is a shoal, existing of just sand, type in Sand. This step is important - it is how you know what each polygon should be mapped to in our finished scenery. A list of "allowed" materials (and thus classes) is available here.

Continue with tracing all shapes on the island: towns, industrial areas, grass, farmland etc.

It is imporant to enable "snaping" now. 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.

  1. Open Settings > Project Properties and click the Snapping options... button.
  2. Click the tickbox(es) in front of your layer(s) and set Tolerance to 20 (map units). A smaller tolerance will make it easier to work with very small and detailed layers.
  3. Click OK to save the snapping options.

Distinguishing Land Class Types from LANDSAT data

You may Google Maps or Yahoo Maps running alongside your program to see what is what on the black/white image, but most areas are recognizable without use of the software. If you need help determining what part of the black-and-white image, please currently refer to the original Stattosoftware Scenery Tutorial. Instead of determining in a single band image you can also combine different ETM+ bands in a RGB file. Some information about different band combinations can be found here [2].

Exporting the shapefile

In order to turn the landclass into scenery we have to split it into seperate shapefiles for each landclass.

  1. Open the Attribute table (Layer > Open Attribute table).
  2. Type "Sand" (or another class) into the search box and press the Search button. This will select all polygons that have the Sand class assigned.
  3. Go to Layer > Save Selection as Shapefile and save the sand shapefile somewhere on your computer.
  4. Do the same for all other classes.
  5. To make the difference between land and sea (landmass) we save the entiry shapefile (Layer > Save as Shapefile).

We have been working with UTM coordinates so far. To generate scenery that can be used in FlightGear we need to convert the shapefiles to the latitude/longitude format.

  • Windows
    1. Download fGIS and install it as described.
    2. Open an empty project and visit Utilities > Shapefile Projection Utility.
    3. Look up your projects UTM coordinate through this image. For Texel this is 31U, so we choose UTM31 in fGIS. If your project is located south of the equator, you tick the S box.
    4. Set the Output Shapefile Project to Lat./Lon..
    5. Now click the Input Shapefile button to load the shapefile that we exported from QGIS.
    6. Using the Output Shapefile button we decide where we want to store the lat/lon shapefile. This has to be a non-exisiting file, so remove before updating.
    7. Click the Convert button.
    8. Repeat this process for all shapefiles.

If you want to see these shapefiles integrated into the Custom Scenery database you can contact papillon81 and statto (through IRC or Forum). Please be remembered that your data has to be derived from freely available (public domain) sources. Other material can not be integrated due to legal issues.

Generating scenery

Please continue with TerraGear to generate the landclass into useable scenery.

External links

Resources