Howto:Create custom terrain: Difference between revisions

Jump to navigation Jump to search
m
Switch to the {{forum link}} template for all forum links.
(Change/add some details about submitting shapes)
m (Switch to the {{forum link}} template for all forum links.)
(20 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{WIP}}
'''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.


Look [http://www.flightgear.org/forums/viewtopic.php?f=5&t=2147 here] an example of the achievable result.
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.


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 know of [[FlightGear]]. Some towns/city (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:
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 [http://mapserver.flightgear.org the mapserver] and, possibly, TerraGear to create new scenery.


#[http://mapserver.flightgear.org/map/?lon=13.40385&lat=52.50199&zoom=11&layers=000000BFFFFFFFFFTFFF Berlin]
=== Evaluating the current data ===
#[http://mapserver.flightgear.org/map/?lon=9.40368&lat=47.63699&zoom=11&layers=000000BFFFFFFFFFTFFF Bodensee surroundings]
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].
#[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=000000BFFFFFFFFFTFFF Carribs]
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 FlightGear interprets the data pertaining to Finistère county. 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=B0000000TFFFTFFFTFFFFFFF Berlin]
# [http://mapserver.flightgear.org/map/?lon=9.40368&lat=47.63699&zoom=11&layers=B0000000TFFFTFFFTFFFFFFF Bodensee surroundings]
# [http://mapserver.flightgear.org/map/?lon=-88.55704&lat=43.98436&zoom=11&layers=B0000000TFFFTFFFTFFFFFFF Oshkosh surroundings]
# [http://mapserver.flightgear.org/map/?lon=-62.87648&lat=17.69865&zoom=10&layers=B0000000TFFFTFFFTFFFFFFF Carribean Islands]


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 15: Line 20:
[[File:C31e36f2a2cbb278a1603dfe2ba91193.media.395x288.png|thumb|200px|Landsat Map Search]]
[[File:C31e36f2a2cbb278a1603dfe2ba91193.media.395x288.png|thumb|200px|Landsat Map Search]]
[[File:1c9334d970963364b5ce1bc3a166a4fa.media.426x192.png|thumb|200px|Preview and download Landsat image]]
[[File:1c9334d970963364b5ce1bc3a166a4fa.media.426x192.png|thumb|200px|Preview and download Landsat image]]
Browse to [http://glcfapp.umiacs.umd.edu:8080/esdi/index.jsp the Earth Science Data Interface interface] to grab your [http://en.wikipedia.org/wiki/Landsat Landsat] data.
Browse to [http://glcfapp.glcf.umd.edu:8080/esdi/index.jsp the Earth Science Data Interface interface] to grab your [http://en.wikipedia.org/wiki/Landsat Landsat] data.


# 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.
# 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.
# 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.
# 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.  
# 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.
# Clicking the ID will not bring you directly to the download page, first you have to click the ''Download'' button.
# Clicking the ID will not bring you directly to the download page, first you have to click the ''Download'' button.
# Download the _nn80.tif.gz file (if this is not available, try an older image).
# 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.
# Uncompress the ''.tif.gz'' files in the directory of your choice.
# Uncompress the ''.tif.gz'' files in the directory of your choice.


Line 34: Line 39:
[[File:QGIS_texel_4.png|thumb|200px|Tracing the small island.]]
[[File:QGIS_texel_4.png|thumb|200px|Tracing the small island.]]
[[File:QGIS_texel_5.png|thumb|200px|The finished small island polygon.]]
[[File:QGIS_texel_5.png|thumb|200px|The finished small island polygon.]]
Using a GIS software gives you the opportunity to realize a full range of interesting operations: modification of VMAP data, updates on the ground classification, etc...
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.


* If you run GNU/Linux, you can install QGIS with your usual package repositery manager; see [http://www.qgis.org/en/download/binaries.html here]. The process is easy and not described here, but it is one the QGIS website.
* QGIS Download for Linux/OSX/Windows [http://www.qgis.org/en/download/current-software.html]
* If you are running Windows, download QGIS from [http://www.qgis.org/en/download/binaries.html here] (Windows - Standalone).


The following is largely adapted from the [http://stattosoftware.com/flightgear/tutorial/index.html original QGIS scenery tutorial], which you may find of use.
# Launch QGIS.
# Launch QGIS.
# Click on <tt>Layer > Add a Raster layer</tt>.
# Click on <tt>Layer > Add a Raster layer</tt>.
# Modify the filter to search for *.tif files.
# Modify the filter to search for *.tif files.
# Add the TIFF file you have just downloaded.
# Add the TIFF file you have just downloaded.
# Click on <tt>Layer > Add a new vector layer</tt> or on the corresponding icon. A dialog should pop up.
# Rightclick on the image in the layer sidebar and choose <tt>Set layer CRS</tt>, to select a projection model. This depends on the location of the area you're about to create. Look up your project's UTM coordinate through [http://upload.wikimedia.org/wikipedia/commons/e/ed/Utm-zones.jpg this image]. For Texel this is 31U, north of the equator, so we choose <tt>Projected Coordinate Systems > Universal Transverse Mercator (UTM) > WSG84 / UTM zone 31N</tt>. Locations south of the equator may need to use the 'N' zones as well. For example, the correct projection for Perth, Australia is <tt>Projected Coordinate Systems > Universal Transverse Mercator (UTM) > WSG84 / UTM zone 50N</tt>. Always select 'WGS84', as that is the globe model used in FlightGear.
#* Make sure the file type is an ESRI Shapefile.  
# Click on <tt>Layer > New > New Shapefile Layer</tt> or on the corresponding icon. A dialog should pop up.
#* Make sure the vector type is set to polygon.  
## 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'.  
## Click the 'specify CRS' button, to select a projection model. This must be the same as we did for the tiff background image.
#* 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.)  
## You need to create a data column for this layer. Create a new attribute called 'class'. Make sure it is a 'text data' (string) column. Add it to the attribute list.  
#* A projection box should pop up. Select 'WGS 1984'. After all, that is the globe model used in FlightGear.
## 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.)  
# 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 59: Line 65:
Continue with tracing all shapes on the island: towns, industrial areas, grass, farmland etc.  
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.


# Open <tt>Settings > Project Properties</tt> and click the Snapping options... button.
===Snapping===
# 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.
It is very important to enable "snapping" now.
 
Snapping means each polygon will fit together nicely, like a jigsaw puzzle. If snapping is not enabled, the polygons will not form a continuous layer, which has a number of different problems.
 
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.
 
# Open <tt>Settings > Snapping Options</tt>.
# 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, while a bigger value makes it easier to snap when zoomed out.
# 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 ====
For people who have not worked with satellite imagery before, it may be difficult to figure out what certain areas of land are. Of course you need Google Maps or similair software running, to see what is what on the black/white image, but most areas can be recognised without. Here is a list which may help you:
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].
* '''Water''' is 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!


===Digitizing tips and tricks===
=== Exporting the shapefile ===
* 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. Merging them into one polygon is pretty straight forward:
*# Go into edit mode and pick the Select feature (<tt>View > Select Features</tt>).
*# Click on the first polygon and then on the other(s), while holding the Ctrl-key. The selected polygons should turn yellow.
*# Click the Merge selected features icon (or <tt>Edit > Merge selected features</tt>).
*# Check whether the classes correspondend (if not, you might be mixing two different areas!) and click OK.
* If there is a lake (or other area) 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.
 
===Eporting 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.  


# Open the Attribute table (<tt>Layer > Open Attribute table</tt>).
# Open the Attribute table (<tt>Layer > Open Attribute Table</tt>).
# 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.
# 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.
# Go to <tt>Layer > Save Selection as Shapefile</tt> and save the sand shapefile somewhere on your computer.
# Go to <tt>Layer > Save Selection as vector file</tt> and save the sand shapefile somewhere on your computer.
# Do the same for all other classes.
# Do the same for all other classes.
# To make the difference between land and sea (landmass) we save the entiry shapefile (<tt>Layer > Save as Shapefile</tt>).
# To make the difference between land and sea (landmass) we save the entiry shapefile (<tt>Layer > Save as...</tt>, ESRI 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'''
*# Download [http://www.forestpal.com/fgis.html fGIS] and install it as described.
*# Open an empty project and visit <tt>Utilities > Shapefile Projection Utility</tt>.
*# Look up your projects UTM coordinate through [http://upload.wikimedia.org/wikipedia/commons/e/ed/Utm-zones.jpg 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.
*# Set the Output Shapefile Project to <tt>Lat./Lon.</tt>.
*# Now click the Input Shapefile button to load the shapefile that we exported from QGIS.
*# 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.
*# Click the Convert button.
*# 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.
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.


== External links ==
== External links ==
{{forum|5|scenery enhancement}}
* [http://www.custom-scenery.org Terragear-cs website]
* [http://www.custom-scenery.org Terragear-cs website]
* [http://wiki.qgis.org QGIS Wiki]
* [http://wiki.qgis.org QGIS Wiki]
* [http://www.flightgear.org/forums/viewforum.php?f=5 Dedicated FlightGear forums for scenery enhancement]
* [http://wiki.osgeo.org/wiki/LandcoverDB_CS_Detail OSGEO Wiki]
* [http://wiki.osgeo.org/wiki/LandcoverDB_CS_Detail OSGEO Wiki]
* {{forum link|t=5566|text=Editing shapefiles for inclussion in official scenery}} (forum topic)
=== Resources ===
* [http://stattosoftware.com/flightgear/tutorial/index.html Tutorial by John Holden]


[[Category:Howto|Using QGIS and satellite pictures]]
[[Category:Howto]]
[[Category:Scenery enhancement|Using QGIS and satellite pictures]]
[[Category:Scenery enhancement]]


[[fr:Howto: Utilisé QGIS et images satellites]]
[[fr:Howto: Utiliser QGIS et images satellites]]

Navigation menu