Notice to YSPilots/YSFLIGHT

Notice to YSPilots/YSFLIGHT
Legacy Pack available under the YSFLIGHT category.
Any individual requests for a model must be made to my email address, see bottom of the page..

Tuesday, 31 December 2013

ArcGIS Domain Coded field to field of domain value

Sorry for the confusing title… Basically this is a tutorial of doing something that took me ages to figure out, though it probably shouldn’t have…

So, first off, you need a feature class with a domain field thats within a Geodatabase (The geodatabase has the domain class)

Then, you need to convert the domain to a table>


My Geodatabase is a list of land ownership in Oregon, called Land_lines.gdb

My domain is dom_LLI_PROP_STATUS, which contains abbreviations of the property ownership like: BLM for Bureau of Land Management.. I want a field that just says “Bureau of Land Management” rather than one that looks like it does, but the actual value is “BLM”.

So, using Domain to Table too, (Data Management>Domains) export the domain


This is what my settings looked like. The code field is the field in the table that leads to the domain, like BLM, the Field Description would be the longer description, like Bureau of Land Management.

Go ahead and export this to a table somewhere… (Remember where though…)

You then want to do a join between the table and your original feature class.

So, my feature class is called “Dissolved Land Lines”, and the code field (With BLM etc etc) in is called “PropertyStatus”. I want to do a join on this field, and the exported table with the Code Field (Which I called “Code” in the settings in the screengrab).

I did this by right clicking the feature class (Within ArcMap) and going to “Joins and Relates” and then to “Join…”. Within Join, I selected the “PropertyStatus” field of the feature class to be the field that the join would be based on. Then the table to be joined was the one we exported above, the join field is the “Code Field” field (Named “Code” above). Hit Okay and off it trundles.

If you look in the attributes table there will now be a nice list of all the vales that relate to the “PropertyStatus” field.


Then go ahead and export the feature class or do whatever you want with it!

Sunday, 15 December 2013

Creeper plushie

So, this is something i made for my other half for Christmas, but i couldn't resist giving it to her early...

Thursday, 12 December 2013

Converting a Digital Elevation Model into a .ter (YS Flight Terrain Model)

I’m currently doing a Masters Degree in GIS and Conservation, the upshot of that is that I get access to all sorts of cool data… (Though this bit is freely available on the net)

One of my old haunts was the game YSFlight, a free flight simulator. Available from here. I used to make planes and things for this simulator, and occasionally maps. Now I learn how to make maps for a living, and have access to all sorts of mapping resources, so I decided i’d try and mix the two together.

YSFlight uses a file called a .fld file, or field file, for its maps. These files are made up of subcomponants, such as objects and terrains (There are more, but I would be here all day). Now, most of YSFlight is a pretty simple code, the planes use polygons and vectors that if you feel like it, you can modify with notepad…

The field files are the same. One of the componants of the field file is a terrain (.ter)  file. Your field file can have many of these .ter files inside it, and these are the bits I’m trying to modify.

So, the terrain file is pretty simple structure wise:

The top of the code looks like this:

NBL 401 401
TMS 50 50

TerrMesh just says what it is. NBL 401 401 gives the number of rows and columns, so 401 rows and 401 columns. (It can be any number really, and usually they’re much smaller)

TMS gives the sizes of the squares, so 50/50 (Not sure if the units are ft or m, I think m) – So they’re 50x50m square, each cell.

Then comes the data, it begins with “BLO” then the elevation, then… some other details that I dont understand.. Colour is one of the tags following.. For this project though, all I need is the elevation.

Here is one bit:

BLO 65 R 1 46 112 10 1 46 112 10

This says that the vertex is 65m up.

So, now comes the good bit… I use a program called ArcMap, its an industry standard piece of GIS software. One of the functions of ArcMap is the ability to export a Raster Digital Elevation Model (Which is basically a picture where darker places mean lower height, lighter places mean higher height) into an ASCII file.

The begining of the ASCII file looks like this:

ncols 401   //Number of Columns
nrows 401 //Number of Rows
xllcenter 460000 //The location of the square
yllcenter 520000 //Also location
cellsize 50 //Size of the cells

Now, with the comments I added, you can see the data contained is very similar to the beginning of the terrain file, contains number of columns, rows and the cell size. The rest of the data is also quite helpful. The rest contains heights separated by a space, for example:

20.0 21.0 21.0 20.0 21.0 21.0 21.0 22.0 22.0 23.0 23.0 23.0 24.0 24.0 24.0

(Thats a pretty flat bit of land) Each new line is a new row in the grid, and each space is a new column.

My coding ability is a bit rubbish… I could’ve probably written a script that simply converted this.. but I’ve no idea where I’d even start, so instead I used notepad++ and excel.

Firstly I opened the ascii file into Excel, it thinks its a CSV file, so I tell it the data is separated by a space, and it makes a nice table where each value is in a different cell, then each row is the length of the number of columns it should be (In my case, 401 columns long, 401 rows high)

I then ran an equation below this selecting the first cell that had the height data in (Cell A6):

="BLO "&A6 &" R 1 46 112 10 1 46 112 10"

This formula takes the value of A6, and adds “BLO “ before, and “ R…etc etc” after the height, so you get a full load of cells with the whole data that the .ter file wants!

I copied this all into notepad++. At the end of each BLO section in the .ter file, after every 401 columns, comes a line which just says “BLO 0.00”, so I did a find and replace, finding the new line marker and replacing it with “BLO 0.00” on a new line. I also did a find and replace as each cell, when copied over, is separated by a tab, so I replaced the tab space with a new line.

This gives the whole middle section of the .ter file, all that remains is to copy it into the .ter, below the TMS 50 50 section, and above the long list of “BLO 0.00” (401 in fact) that ends the file (before the final END).


I ran this for a small section of coastline in the UK, Ordinance Survey Grid Square NZ62, around Saltburn. The data came from the OS’ Panorama DTM.

So, I did all this and created a new .ter file. This i imported into Scenery Editor (From The file is huge, 5mb in total, and not really practical for an everyday map being used to fly around in, but it is a technical achievement! Here is the result being flown in YSFLIGHT:


Not hugely impressive I know!

The only real problem, apart from the big file size, is that the image is back to front, North is South…This could quite easily be modified though if it is a common problem that it flips it around.

The data is here:

If you want it. The OS data is crown copyright, details in that link<

Anyways! Fly safe