Board index FlightGear Development Scenery

TerraGear guide on Windows

Questions and discussion about enhancing and populating the FlightGear world.

TerraGear guide on Windows

Postby legoboyvdlp » Thu Apr 11, 2019 12:42 pm

Hi,
Here is my guide as to how to run TerraGear to generate scenery - primarily focused on windows, but not exclusively.

Installing Tools
First up, what to install. I got my TerraGear from http://www.mediafire.com/file/ul2xy2ykgig2mct/160605_Sucessfull_Terragear_Win_Built.7z -- this is by BecOzlacan and is very stable and works well. It contains both the GUI and the main program - for convencience, I will use the GUI.

I also installed QGis 3 in order to be able to edit shapefiles.

I also used World Editor -- https://developer.x-plane.com/tools/worldeditor/ - this is needed to parse data.

Acquiring Data
So after installing TerraGear, first thing you need to do is acquire data.

I got:
- Landmass data -- worldwide from OSM at: https://osmdata.openstreetmap.de/download/land-polygons-split-4326.zip (531MB)
- Corine data -- available from https://www.eea.europa.eu/data-and-maps/data/clc-2006-vector-data-version-3 --> under GIS data, there are several .zip files. I downloaded most of these - unfortunately they are huge downloads!
- OSM line data -- available from https://download.geofabrik.de/ - you can click on continent - country - and in some countries, subregions, then download the appropriate shp.zip file.
- Elevation data -- available from http://viewfinderpanoramas.org/Coverage%20map%20viewfinderpanoramas_org3.htm
- Airport data -- available through World Editor by "importing from airport scenery gateway". Unfortunately, for large areas you need to find out what airports are within the area and import each one by hand.

This will be sufficient for europe - however, for other areas you need to find VMAP files from somewhere - alternatively, many countries do publish their own data sets.
Note - you can also try CLC_2012 from https://www.eea.europa.eu/data-and-maps ... 012-vector but I have not yet tried it and don't know if it will work
Last edited by legoboyvdlp on Thu Jun 13, 2019 9:48 am, edited 2 times in total.
User avatar
legoboyvdlp
 
Posts: 6710
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: TerraGear guide on Windows

Postby legoboyvdlp » Thu Apr 11, 2019 1:25 pm

For the purposes of this tutorial I will be generating a small area around London Heathrow (N51W001 tile) in order to use the new airport layout properly. My coordinates were:
Image

Notice that the download buttons are inoperative, since the associated servers have gone offline!

Folder Structure
I created a new folder in my FlightGear folder - EGLL. Under this folder, I created the folder "data sources" (for .zip files) and "data" (for extracted files). All other folders will be automatically generated by TerraGear.

Next, I created a new project in QGIS, "EGLL", and saved it in that folder EGLL as EGLL.qgs.

Finally, I added all folders in TerraGUI - as such:
Image

Elevation Data
So, I downloaded tile M30 from Viewfinder Panorama and put it into "data sources". Then, I extracted the files and copies them to a new folder, ../data/SRTM-3. Next, using a handy plugin for QGIS, "load them all", I load the files as a raster layer. If you do not have "load them all", you can instead use Layer > Add Layer > Add Raster Layer or Ctrl + Shift + R to load the .hgt files. I checked the coordinates to make sure that the area I wanted was included, and indeed it was. If it had not been, I would have needed to download layer M31 instead which was farther over to the east.

Next, I selected the layers that I did not need in the bottom left layers tab, and removem them in the menu opened by right clicking, leaving only N51W001. I could then delete the un-needed layers in the /data/SRTM-3 folder. The result was as follows:

Image

Next, I opened up TerraGUI and with the following options started to parse the elevation data.

Image

This took only a few seconds, and produced a new folder "work", containing SRTM-3\w010n50\w001n51 with many .gz files containing all the elevation data.


Landmass Data
Meanwhile, I was downloading landmass polygons from OSM.
Once it finished, before I did anything else, I disabled "render" on the bottom toolbar in QGIS. This is vital unless you have a supercomputer as otherwise it will try to render all 500MB of data totally freezing QGIS!

I copied land-polygons-split-4326.zip to data sources, extracted, and again copied the files to a new folder "osm_landmass". Then, I made sure that "render" was disabled, and imported it into QGIS using Ctrl + Shift + V (open vector layer). Alternatively, you can use Layer > Add Layer > Add Vector Layer.
Image

Don't worry if you don't see anything happen - that's because render is disabled. I selected the land_polyons in the layer menu and hit toggle editing, then used the select by area tool to select only what I needed.
Image

I then inverted selection using this tool:
Image

and hit Delete (SUPR or DELETE on most keyboards - alternatively use the red trashcan icon on the toolbar) to delete the data, hitting "Yes". Then, I re-enabled "render" and saw this:
Image
(I set the transparency of the HGT data to 50% by right clicking it in the layer menu and hitting properties and changing transparency.)

Finally, I disabled editing mode by clicking "Toggle Editing" again, making sure to save the data. Note that this overwrites the 530MB shapefile... so that's why I kept the .zip in data sources, so for another later project I can just go back to data sources and re-extract the shapefile!

This completes pre-processing of landmass data.

Processing Airports
Next, I looked up using TerraMaster by hovering over the zone to see which airports were in the zone. I found the following:
Image

I then opened up World Editor, made a new project "heathrow-flightgear", and imported each of these airports using the "Import from Scenery Gateway button". By entering the ICAO in the search bar selecting each airport using Shift-Click, then modifying the search and selecting the next airport using Shift-Click, you can import them all at once.

This is the result:
Image

The next step is to go through each airport and remove things that are not needed - specifically, objects, ground vehicles, ground routes, forests, facades, and exclusion zones.

You should keep at least these ones:
  • Markings
  • Runways
  • Taxiways
  • Tower, Beacon and Boundaries

I also reccomend to leave lines and draped polygons which you will need to convert to taxiway markings and taxiways.

I left ATC flows and traffic routes in order to create groundnets later.

The next step is to fix various things.

First, I started to parse polygons. The first airport was EGGW.
You can simply select all draped polygons (no need to select ones that are "safety-yellow.pol" or similar - only ones that are concrete or asphalt are needed), go to the edit menu, "convert to", and convert directly to taxiways!


First, I used the "convert to" tool again to replace linear features.

Notice that not all linear features are supported by genapts! You will need to run genapts and see if it gives an error message. It will clearly tell you what linear marking code it cannot recognize (e.g. it cannot recognize the new red lines), so you can use "replace all" in notepad++ to replace with a similar, working code. For instance, I would replace all codes for red line markings with "20", as such:
Image

This may help: http://developer.x-plane.com/wp-content ... 1-2019.pdf
Deprecated as of WED 1.7

First, I did lines. Only Luton and Dunsford had them, so it was easy.
I simply observed what type of line was already there and created a new linear features - in this case, SOLID WHITE (ROADWAY) and traced over the existing line, then deleted it. The reason this is necessary is that terragear cannot parse lines, but it can parse taxiway markings.

I first copied the file "C:\Users\redpa\Documents\Programs\X-Plane 11\Custom Scenery\Heathrow-Test\earth.wed.xml" to a new folder, "removepolys".
The first thing I did was remove each airport apart from EGGW from the scenery inside WED. Then, I exported the airport apt.dat, fixing any issues brought up by the validator (in this case, none). Finally, I saved my work in WED.

Next, I saved this following file inside the folder "removepolys" as transform.xsl
Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
  <html>
  <body>
  <h2>Airport WED_Ring Objects</h2>
  <div>
    <xsl:for-each select="doc/objects/object[hierarchy/@name='Ring' and @class='WED_Ring']">
        <xsl:variable name="current_id" select="@id"/>
        <xsl:variable name="current_parent_id" select="@parent_id"/>
        <xsl:apply-templates select="preceding-sibling::*[@id=$current_parent_id]/polygon_placement"/><xsl:apply-templates select="following-sibling::*[@parent_id=$current_id]/point"/>
    </xsl:for-each>
  </div>
  </body>
  </html>
</xsl:template>

<xsl:template match="polygon_placement">
  <span>110
  <xsl:choose>
    <xsl:when test="@resource='lib/airport/pavement/concrete_1D.pol'">2</xsl:when>
    <xsl:when test="@resource='lib/airport/pavement/concrete_2D.pol'">2</xsl:when>
    <xsl:when test="@resource='lib/airport/pavement/concrete_3D.pol'">2</xsl:when>
    <xsl:when test="@resource='lib/airport/pavement/concrete_4D.pol'">2</xsl:when>
    <xsl:when test="@resource='lib/airport/pavement/concrete_5D.pol'">2</xsl:when>
    <xsl:when test="@resource='lib/airport/pavement/concrete_6D.pol'">2</xsl:when>
    <xsl:otherwise>1</xsl:otherwise>
  </xsl:choose>
  0.25&#160;<xsl:value-of select="@heading"/>&#160;Ring</span><br/>
</xsl:template>

<xsl:template match="point">
  <span>
  <xsl:choose>
    <xsl:when test="../@class='WED_SimpleBoundaryNode'">
      <xsl:if test="position() != last()">111&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">113&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>
    </xsl:when>
    <xsl:when test="@ctrl_latitude_lo=0.0 and @ctrl_longitude_lo=0.0 and @ctrl_latitude_hi=0.0 and @ctrl_longitude_hi=0.0">
      <xsl:if test="position() != last()">111&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">113&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>
    </xsl:when>
    <xsl:when test="@ctrl_latitude_lo=0.0 and @ctrl_longitude_lo=0.0 and @split=1">
      <xsl:if test="position() != last()">111&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">113&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>
      <br/>
      <xsl:if test="position() != last()">112&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">114&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>&#160;
      <xsl:value-of select="format-number(@latitude + @ctrl_latitude_hi, '0.000000000')"/>&#160;<xsl:value-of select="format-number(@longitude + @ctrl_longitude_hi, '0.000000000')"/>
    </xsl:when>
    <xsl:when test="@ctrl_latitude_hi=0.0 and @ctrl_longitude_hi=0.0 and @split=1">
      112&#160;&#160;<xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>&#160;
      <xsl:value-of select="format-number(@latitude - @ctrl_latitude_lo, '0.000000000')"/>&#160;<xsl:value-of select="format-number(@longitude - @ctrl_longitude_lo, '0.000000000')"/>
      <br/>
      <xsl:if test="position() != last()">111&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">113&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>
    </xsl:when>
    <xsl:when test="@split=1 and ((@ctrl_latitude_hi != @ctrl_latitude_lo * -1) or (@ctrl_longitude_hi != @ctrl_longitude_lo * -1))">
      TODO:
    </xsl:when>
    <xsl:otherwise>
      <xsl:if test="position() != last()">112&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">114&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>&#160;
      <xsl:value-of select="format-number(@latitude + @ctrl_latitude_hi, '0.000000000')"/>&#160;<xsl:value-of select="format-number(@longitude + @ctrl_longitude_hi, '0.000000000')"/>
    </xsl:otherwise>
  </xsl:choose>
  </span><br/>
</xsl:template>

</xsl:stylesheet>


Then, I opened the earth.wed.xml and added a new line as such:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="transform.xsl"?>     <== add this line to the airport earth.wed.xml file
<doc>
    <objects>
        <object class="WED_Root" id="1" parent_id="0">


(of course, removing the comment after <==)
Then, in a CMD window, I ran,
Code: Select all
cd Documents\Programs\X-Plane 11\Custom Scenery\removepolys
python -m http.server 2000


In Chrome, I finally simply entered http://localhost:2000/earth.wed.xml, and received what I should enter. I copied everything below Airport WED_Ring Objects, and pasted that into EGGW.dat. I put it in directly before the first 120 LINEAR FEATURE item.

Image

There are some "TODO:" I simply remove them, as they indicate overlapping polygons. I can fix those later. So, I paste them in to the EGGW.dat, and then open my Heathrow-Test project in WED, remove the old London Luton, and import the new one from EGGW.dat.

This is rather painstaking but is much faster than doing it manually!
Last edited by legoboyvdlp on Thu Jun 13, 2019 10:03 am, edited 3 times in total.
User avatar
legoboyvdlp
 
Posts: 6710
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: TerraGear guide on Windows

Postby wkitty42 » Thu Apr 11, 2019 7:54 pm

man! this is so nice... i'd love to see the same for linux... the last time i went playing in this area was before the shape files server went away and even then it was basically fumbling along blindly and hoping that enough fingers were crossed to make it work...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5425
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: TerraGear guide on Windows

Postby wlbragg » Thu Apr 11, 2019 8:15 pm

Thank you @legoboyvdlp, very nice refresher course. I didn't read through the entire guide so forgive me if I ask a dumb question. Do you or have you used textured line feature in the TerraGear tools? I think it is a really important and underused feature available in the tool chain. OSM2CITY road data kind of goes hand in hand with that concept. If you use the texture line data feature in the tool chain with the OSM line data and OSM2CITY road textures it should match nicely.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4684
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: TerraGear guide on Windows

Postby legoboyvdlp » Thu Apr 11, 2019 8:22 pm

I haven't used it yet, no, I thought it was still experimental? But I can try it sometime later, should be interesting to see how well it works.

and also this is nowhere near finished yet :)

I need to demonstrate shapefile parsing before showing how to run ogr-decode and tg-construct.


Wkitty, most things should work on Linux, although the commands etc will be different and not sure if WED is available for Linux :)
User avatar
legoboyvdlp
 
Posts: 6710
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: TerraGear guide on Windows

Postby wlbragg » Thu Apr 11, 2019 8:35 pm

I thought it was still experimental?

I suppose it might still be considered that, but it works well enough that it is far better than no texture at all, IMHO. The intersections have not been ironed out yet I think is the main thing that might label it as experimental.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4684
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: TerraGear guide on Windows

Postby daweed » Fri Apr 12, 2019 7:57 am

Thanks @legoboyvdlp , that will clearly help me step by step to regenerate LFLL.
I will give a try this we under Linux [ have compiled Terragear & TerragearGUI with download & compile script.
Actually downloading primary stuff (Corine data, OSM ... etc) and will report asap :)

Thanks again for your time
Linux Mint 18.3
AMD FX 4300 Quad-Core Black Edition|20 Go RAMGeForce GTX 750 Ti
FG Interface
Lyon Saint Exupery Scenery

ATC on LFLL on Friday 19:00 UTC => 22:00 UTC
daweed
 
Posts: 296
Joined: Thu Dec 11, 2014 10:45 am
Location: LFKP LFLL
Callsign: daweed
OS: Windows 10 Familly

Re: TerraGear guide on Windows

Postby xDraconian » Fri Apr 12, 2019 8:02 am

Great job with your write up and thank you for helping the community understand this mysterious process of generating scenery. Looking forward to your next post.
xDraconian
 
Posts: 228
Joined: Sun Jan 21, 2018 5:53 am
Version: Git
OS: Linux Mint

Re: TerraGear guide on Windows

Postby legoboyvdlp » Fri Apr 12, 2019 11:33 am

Airports, continued
After finishing parsing all polygons, I manually edit any errors (self-intersecting taxiways, etc), then validate and export the airport.dat. I put this file under data/Airports. After that, I open TerraGear GUI and set it up as follows:
Image

However, genapts850 seems rather buggy and fails to do the airports - so I need to change to "Single Airports" and do each one manually.

I notice that the failing airports are:
  • EGGW
  • EGKK
  • EGLD
  • EGLF
  • EGLM
  • EGTB
  • EGTF

For all of these, I quite simply have to edit their apt.dat until it works with genapts850. Unfortunately the only way is to remove elements until it generates in order to find the bad ones.

Once I finished fixing all these airports, I manually counted the ICAO.btg.gz files in AirportObj\w010n50\w001n51 to make sure all the airports were there.

OSM Vector Data
Next, I downloaded the OSM data from geofabrik. I put england-latest-free.shp.zip in data sources and extracted it to data sources. Then, I deleted the following -- they are mostly irrelevant for our purposes.
  • gis_osm_transport_free_1
  • gis_osm_transport_a_free_1
  • gis_osm_traffic_free_1
  • gis_osm_traffic_a_free_1
  • gis_osm_natural_free_1 (not natural_a_free_1)
  • gis_osm_pois_a_free_1
  • gis_osm_pois_free_1
  • gis_osm_pofw_a_free_1
  • gis_osm_pofw_free_1
  • gis_osm_places_a_free_1
  • gis_osm_places_free_1
  • gis_osm_buildings_a_free_1
Then, I imported them all into QGIS using "load them all".

The next step is to trim them to the correct area, then use the attribute table to extract the data we need.

First, we toggle editing on each layer (right click it in the layer menu or use the toolbar icon). Then, again using "select by area" and "invert selection", we are able to delete areas that we do not need. We then un-toggle editing, choosing to save the data, and go to the next layer.

If you find any layers with no data in your region, merely delete them.

Next, you want to select the first layer, hit "save as", and save it under /data/ as osm_description. For instance, my first layer was osm_waterways, so I saved it as osm_rivers.shp. Then, toggle editing on the new layer, right click it in the layer menu, and hit "Open Attribute Table".

Image

In the bottom left toolbar, create a "Field Filter" on fclass, and enter in the category you want. For instance, in my case, "river". The wiki may help to find the correct categories. Then, click in the top right to select all rivers, exit the attribute table, and invert selection to select everything that isn't a river. Then delete that, leaving only the category you want.

Image

then, go back to your original layer, save as again, and repeat for each category you want. For example, I will extract "river", "canal", and "stream" from osm_waterways_free_1.shp, saving as osm_river, osm_canal, and osm_stream respectively. Finally, remove the original layer from the layer menu - you should have instead seperate layers for each category type (that is, rivers, canals, and streams).

Repeat this for each shapefile. I normally extract rivers, streams, canals from osm_waterways, lakes and rivers (saving as osm_lakes) from osm_waterways_a (polygons), motorway, trunk, primary, secondary, tertiary, and service roads from osm_roads, and depending on the quality sometimes landuse information. The end result should be seperate shapefiles in /data/ - at this point you can delete all the unzipped files in /data sources/.

The result after doing all except for roads:
Image
User avatar
legoboyvdlp
 
Posts: 6710
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: TerraGear guide on Windows

Postby legoboyvdlp » Sat Apr 13, 2019 1:47 pm

CORINE Vector Data
Next, I downloaded all the CORINE shapefiles. This took quite some time! I extracted them to data sources, and used "load them all" to load each one again. Then, I merely used "save as" to move them to /data/ (using http://wiki.flightgear.org/CORINE_to_materials_mapping to help find what name to save them under), trimming them using "select by area", "invert selection", and deleting un-needed parts. Some did not have any data in the region, so I merely deleted those.

TBC...
User avatar
legoboyvdlp
 
Posts: 6710
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: TerraGear guide on Windows

Postby legoboyvdlp » Wed Apr 24, 2019 4:47 pm

Parsing data using OGR-decode

Now, after doing all CORINE, I opened up TerraGearGUI and the materials tab. First, I right-clicked on Airports to remove it. Then, I assigned materials using http://wiki.flightgear.org/CORINE_to_materials_mapping. All roads were set to Road except osm_motorway, which was Freeway . All streams / rivers / canals were set to streams. Line data lengths used were:

  • Motorway: 14
  • Primary / Trunk: 12
  • Secondary: 10
  • Tertiary / Unclassified: 8
  • Railroad: 9
  • River: 10
  • Stream / Canal: 9

Image

Then, I enabled textured lines (optional), and hit "decode shapefile(s) and apply material(s). It took some time but eventually finished and produced data in /work/

TG-Construct
Finally, we go to the construct tab. First, we need to edit default-priorities.xml. We directly hit "generate scenery" - it finishes immediately at 100%, so we know default-priorities has errors. So, I open TerraGear\share\TerraGear\default-priorities.xml and look in it, comparing to the list in TerraGui.

Image

Any which do not exist in default-priorities.xml, I need to add to the default-priorities.xml. In most cases I just duplicate an existing line that has a similar name - e.g. I copy DryCrop line and rename it to DryCropPastureCover:

Image

Once I finish doing this, I hit "generate scenery" again, and wait!
User avatar
legoboyvdlp
 
Posts: 6710
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: TerraGear guide on Windows

Postby BecOzIcan » Sat Apr 27, 2019 4:25 pm

legoboyvdlp wrote in Wed Apr 24, 2019 4:47 pm:Any which do not exist in default-priorities.xml, I need to add to the default-priorities.xml. In most cases I just duplicate an existing line that has a similar name - e.g. I copy DryCrop line and rename it to DryCropPastureCover!


When adding new textures to the Default Priorities file, please remember the ORDER of textures in the file conditions the order of drawing layers in the scenery 'sandwich'.

Taking your screenshot as example, DIRT is drawn over any other texture so it will 'hide' for example a Cemetery texture (lower in the list) where both layers overlap.

For the same reason DEFAULT/LANDMASS should always be the last texture in your priorities file (drawn at the bottom of the sandwich) and anything Water, Human or Line Feature (rail, road, river, lake etc) should be listed first (drawn on top of the sandwich)

Cheers
Ian
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1034
Joined: Tue Oct 04, 2011 10:43 pm
Location: Sydney, NSW, Australia
Version: 2.12
OS: Win10

Re: TerraGear guide on Windows

Postby legoboyvdlp » Sun May 05, 2019 5:00 pm

Just a note - I discovered Edit > Convert To menu in WED today. No need for scripts to convert polygons... because you can very simply just select the polygon and hit Convert To --> Taxiway! :D
User avatar
legoboyvdlp
 
Posts: 6710
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: TerraGear guide on Windows

Postby legoboyvdlp » Thu Jun 13, 2019 9:48 am

Corrected various typos, fixed the link to landmass data (original service was discontinued). Clarified some points and fixed polygon conversion.
User avatar
legoboyvdlp
 
Posts: 6710
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: TerraGear guide on Windows

Postby xDraconian » Sun Jun 16, 2019 8:15 am

Transform script updated to eliminate TODO:

Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
  <html>
  <body>
  <h2>Airport WED_Ring Objects</h2>
  <div>
    <xsl:for-each select="doc/objects/object[hierarchy/@name='Ring' and @class='WED_Ring']">
        <xsl:variable name="current_id" select="@id"/>
        <xsl:variable name="current_parent_id" select="@parent_id"/>
        <xsl:apply-templates select="preceding-sibling::*[@id=$current_parent_id]/polygon_placement"/><xsl:apply-templates select="following-sibling::*[@parent_id=$current_id]/point"/>
    </xsl:for-each>
  </div>
  </body>
  </html>
</xsl:template>

<xsl:template match="polygon_placement">
  <span>110
  <xsl:choose>
    <xsl:when test="@resource='lib/airport/pavement/concrete_1D.pol'">2</xsl:when>
    <xsl:when test="@resource='lib/airport/pavement/concrete_2D.pol'">2</xsl:when>
    <xsl:when test="@resource='lib/airport/pavement/concrete_3D.pol'">2</xsl:when>
    <xsl:when test="@resource='lib/airport/pavement/concrete_4D.pol'">2</xsl:when>
    <xsl:when test="@resource='lib/airport/pavement/concrete_5D.pol'">2</xsl:when>
    <xsl:when test="@resource='lib/airport/pavement/concrete_6D.pol'">2</xsl:when>
    <xsl:otherwise>1</xsl:otherwise>
  </xsl:choose>
  0.25&#160;<xsl:value-of select="@heading"/>&#160;Ring</span><br/>
</xsl:template>

<xsl:template match="point">
  <span>
  <xsl:choose>
    <xsl:when test="../@class='WED_SimpleBoundaryNode'">
      <xsl:if test="position() != last()">111&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">113&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>
    </xsl:when>
    <xsl:when test="@ctrl_latitude_lo=0.0 and @ctrl_longitude_lo=0.0 and @ctrl_latitude_hi=0.0 and @ctrl_longitude_hi=0.0">
      <xsl:if test="position() != last()">111&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">113&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>
    </xsl:when>
    <xsl:when test="@ctrl_latitude_lo=0.0 and @ctrl_longitude_lo=0.0 and @split=1">
      <xsl:if test="position() != last()">111&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">113&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>
      <br/>
      <xsl:if test="position() != last()">112&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">114&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>&#160;
      <xsl:value-of select="format-number(@latitude + @ctrl_latitude_hi, '0.000000000')"/>&#160;<xsl:value-of select="format-number(@longitude + @ctrl_longitude_hi, '0.000000000')"/>
    </xsl:when>
    <xsl:when test="@ctrl_latitude_hi=0.0 and @ctrl_longitude_hi=0.0 and @split=1">
      112&#160;&#160;<xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>&#160;
      <xsl:value-of select="format-number(@latitude - @ctrl_latitude_lo, '0.000000000')"/>&#160;<xsl:value-of select="format-number(@longitude - @ctrl_longitude_lo, '0.000000000')"/>
      <br/>
      <xsl:if test="position() != last()">111&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">113&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>
    </xsl:when>
    <xsl:when test="@split=1 and ((@ctrl_latitude_hi != @ctrl_latitude_lo * -1) or (@ctrl_longitude_hi != @ctrl_longitude_lo * -1))">
      112&#160;&#160;<xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>&#160;
      <xsl:value-of select="format-number(@latitude - @ctrl_latitude_lo, '0.000000000')"/>&#160;<xsl:value-of select="format-number(@longitude - @ctrl_longitude_lo, '0.000000000')"/>
      <br/>
      111&#160;&#160;<xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>
      <br/>
      <xsl:if test="position() != last()">112&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">114&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>&#160;
      <xsl:value-of select="format-number(@latitude + @ctrl_latitude_hi, '0.000000000')"/>&#160;<xsl:value-of select="format-number(@longitude + @ctrl_longitude_hi, '0.000000000')"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:if test="position() != last()">112&#160;&#160;</xsl:if>
      <xsl:if test="position() = last()">114&#160;&#160;</xsl:if>
      <xsl:value-of select="@latitude"/>&#160;<xsl:value-of select="@longitude"/>&#160;
      <xsl:value-of select="format-number(@latitude + @ctrl_latitude_hi, '0.000000000')"/>&#160;<xsl:value-of select="format-number(@longitude + @ctrl_longitude_hi, '0.000000000')"/>
    </xsl:otherwise>
  </xsl:choose>
  </span><br/>
</xsl:template>

</xsl:stylesheet>
xDraconian
 
Posts: 228
Joined: Sun Jan 21, 2018 5:53 am
Version: Git
OS: Linux Mint


Return to Scenery

Who is online

Users browsing this forum: No registered users and 4 guests