Elevation Grid Generator

Note that alterations to the YSFlight .EXE is forbidden
User avatar
decaff_42
Staff
Staff
Posts: 3838
Joined: Sat Oct 29, 2011 7:23 pm
Favorite Aircraft: SR-71 Blackbird
Location: Eastern United States
OS: Mac OSX
Has thanked: 844 times
Been thanked: 1726 times
Contact:

Elevation Grid Generator

Post by decaff_42 »

Excelent Tutorial Video! :D
Check out my website YSDecaff for all my tutorials and addon releases.
Visit my GitHub page for Python codes: https://github.com/decaff42?tab=repositories

YSFlight Addon Database - Find links to nearly every addon made for YSFlight!
Submit Addon To Database
User avatar
Barr
Veteran
Veteran
Posts: 1012
Joined: Wed Mar 28, 2012 8:49 pm
Favorite Aircraft: The Boeing 757
Location: Providence, Rhode Island
OS: Windows 10/Gentoo
Has thanked: 272 times
Been thanked: 206 times

Elevation Grid Generator

Post by Barr »

Am I doin it right?

600x600 @ aprox 3min.


Edit:

How can you lower the height amplification. For example for a maximum of 50ft? I tried using decimals but the program makes everything flat.
Attachments
Screenshot (435).png
Image
Beginner ATC for hire!
Current Projects:
-Pilatus PC12
-Mooney M20
-New England Scenery
Fine Print:
**Word of Caution**
My knowledge is limited. Anything I write in my posts may or may not be accurate. To be honest I think its all crap.
User avatar
Barr
Veteran
Veteran
Posts: 1012
Joined: Wed Mar 28, 2012 8:49 pm
Favorite Aircraft: The Boeing 757
Location: Providence, Rhode Island
OS: Windows 10/Gentoo
Has thanked: 272 times
Been thanked: 206 times

Re: Elevation Grid Generator

Post by Barr »

Bumping old topic for goodness...

How does the height amplification work? Is 255m default? So if its at 1 the max height will be 255m? Right and if its at .5 the max height will be 122.5m, correct?
Image
Beginner ATC for hire!
Current Projects:
-Pilatus PC12
-Mooney M20
-New England Scenery
Fine Print:
**Word of Caution**
My knowledge is limited. Anything I write in my posts may or may not be accurate. To be honest I think its all crap.
User avatar
Flake
VFA-49
VFA-49
Posts: 4375
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 861 times
Been thanked: 1279 times
Contact:

Re: Elevation Grid Generator

Post by Flake »

1 to 1 of the pixel value.

Height amplification * pixel value = height in meters of point.

So if the heigh amp is 1, and the pixel is 255 white, then the point would be 255m. ;)

EDIT: 3000th post! Bow before my true Planar form! :lol:
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!
User avatar
Barr
Veteran
Veteran
Posts: 1012
Joined: Wed Mar 28, 2012 8:49 pm
Favorite Aircraft: The Boeing 757
Location: Providence, Rhode Island
OS: Windows 10/Gentoo
Has thanked: 272 times
Been thanked: 206 times

Re: Elevation Grid Generator

Post by Barr »

OfficerFlake wrote:1 to 1 of the pixel value.

Height amplification * pixel value = height in meters of point.

So if the heigh amp is 1, and the pixel is 255 white, then the point would be 255m. ;)

EDIT: 3000th post! Bow before my true Planar form! :lol:
Ay mind dumbing that down for me :?:

oh wait never saw the white after 255. So basically the brighness of each pixel is basically the height.


Also Im using 100x100 pixel bitmaps but it takes about 30 seconds for it to process it? Surely cant be my computer? And to add the .flds are coming out blank and zoomed in? No elevation grids
Image
Beginner ATC for hire!
Current Projects:
-Pilatus PC12
-Mooney M20
-New England Scenery
Fine Print:
**Word of Caution**
My knowledge is limited. Anything I write in my posts may or may not be accurate. To be honest I think its all crap.
User avatar
Flake
VFA-49
VFA-49
Posts: 4375
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 861 times
Been thanked: 1279 times
Contact:

Re: Elevation Grid Generator

Post by Flake »

BARRACUZ wrote:So basically the brighness of each pixel is basically the height.
Exactament.

BARRACUZ wrote:Also Im using 100x100 pixel bitmaps but it takes about 30 seconds for it to process it? Surely cant be my computer? And to add the .flds are coming out blank and zoomed in? No elevation grids
Probably your PC.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!
User avatar
Barr
Veteran
Veteran
Posts: 1012
Joined: Wed Mar 28, 2012 8:49 pm
Favorite Aircraft: The Boeing 757
Location: Providence, Rhode Island
OS: Windows 10/Gentoo
Has thanked: 272 times
Been thanked: 206 times

Re: Elevation Grid Generator

Post by Barr »

Hmm okay I'll check on it. Though a 3.3ghz processor with 8gb of ram should be plenty.
Image
Beginner ATC for hire!
Current Projects:
-Pilatus PC12
-Mooney M20
-New England Scenery
Fine Print:
**Word of Caution**
My knowledge is limited. Anything I write in my posts may or may not be accurate. To be honest I think its all crap.
User avatar
kiwiflieger
Contributor
Contributor
Posts: 227
Joined: Thu Mar 27, 2014 7:09 am
Favorite Aircraft: Die Fledermaus
Has thanked: 125 times
Been thanked: 92 times

Re: Elevation Grid Generator

Post by kiwiflieger »

Apologies for bumping old topic, but I think I may have a fix for:
BARRACUZ wrote:Also Im using 100x100 pixel bitmaps but it takes about 30 seconds for it to process it? Surely cant be my computer? And to add the .flds are coming out blank and zoomed in? No elevation grids
It may not be the PC, as I have very similar specs to BARRACUZ, but the fld.
I have conducted some testing of this program and found that removing the fld information in a text editor and leaving just the elevation grid information, then saving as a .ter file, gives a working elevation grid.

Example:

Code: Select all

FIELD
FLDNAME WANAKAELEV
GND 0 0 215
SKY 23 106 189
GNDSPECULAR FALSE
DEFAREA LAND
BASEELV 0.00m
MAGVAR 0.00deg
CANRESUME TRUE
PCK "00000000.ter" 274601
TerrMesh
SPEC FALSE
NBL 501 546
TMS 108.00 108.00
CBE 0.00 1833.76 46 112 10 194 169 92
BLO 0.00 R 1 46 112 10 1 46 112 10
BLO 0.00 L 1 73 122 25 1 73 122 25
BLO 0.00 R 1 100 133 40 1 73 122 25
If the start of the generated elevation grid looks like this, then remove this:

Code: Select all

FIELD
FLDNAME WANAKAELEV
GND 0 0 215
SKY 23 106 189
GNDSPECULAR FALSE
DEFAREA LAND
BASEELV 0.00m
MAGVAR 0.00deg
CANRESUME TRUE
PCK "00000000.ter" 274601
So the file starts at TerrMesh.

Hope this helps...
Currently dormant... playing IL2 Cliffs of Dover
User avatar
Barr
Veteran
Veteran
Posts: 1012
Joined: Wed Mar 28, 2012 8:49 pm
Favorite Aircraft: The Boeing 757
Location: Providence, Rhode Island
OS: Windows 10/Gentoo
Has thanked: 272 times
Been thanked: 206 times

Re: Elevation Grid Generator

Post by Barr »

Can confirm What kiwi said. I kept having troubles with the output flds. Simply deleting a few lines and saving as a ter file gave me a working elevation grid.


Also just so others are aware both kiwi and I have noticed that the program will also include any "picture" that shows up on screen and behind the running program window. For example if you decide to load and generate a bitmap while having a chrome window or fancy wallpaper in the background you will see it in the resulting elevation grid.
Image
Beginner ATC for hire!
Current Projects:
-Pilatus PC12
-Mooney M20
-New England Scenery
Fine Print:
**Word of Caution**
My knowledge is limited. Anything I write in my posts may or may not be accurate. To be honest I think its all crap.
User avatar
DD-Destroyer
Contributor
Contributor
Posts: 323
Joined: Tue May 22, 2012 11:45 pm
Favorite Aircraft: FA-50 Golden Eagle
Location: Seoul
OS: Windows
Has thanked: 4 times
Been thanked: 165 times
Contact:

Re: Elevation Grid Generator

Post by DD-Destroyer »

What is my problem???????
User avatar
Barr
Veteran
Veteran
Posts: 1012
Joined: Wed Mar 28, 2012 8:49 pm
Favorite Aircraft: The Boeing 757
Location: Providence, Rhode Island
OS: Windows 10/Gentoo
Has thanked: 272 times
Been thanked: 206 times

Re: Elevation Grid Generator

Post by Barr »

DD-Destroyer wrote:What is my problem???????
I'm a boob at this so take my suggestions lightly. Hopefully flake or grigor can chime in.

1. The grid generator will generate the bitmap plus whatever is under or ontop of it on the screen. So let's say you have a pickachu wallpaper and have a text document open. The generator will pick these up and include it in the end result so you will get a mountain plus a pikachu mountain. So set your wall paper to none or black and drag all windows even the generator itself away from under the image.

2. Make sure to set the program to run as administrator and run it under xp compatibility. Also try not to run major cpu hog programs like chrome or a videogames. I've noticed that the generator will take a tad longer probably due to the CPU usage priority.

3. Make sure the bitmap is a true 100 pixel by 100 pixel image. I used paint.net and it has some weird settings when you resize so depending on your program double check. Remember that the generator takes the color value of each and every pixel and turns it into a coordinate for ys. So the more pixels or larger the image is the longer it will take to process it all.

4.The generator uses raw cpu power to make the grids so if you have an older machine it will take longer



And if someone can please explain in some detail how to properly use the height amplification. I'm having g trouble getting accurate sized grids since I don't know what to multiply the height amplification by. Like do you average out your highest or Max rgb values and use that?
Image
Beginner ATC for hire!
Current Projects:
-Pilatus PC12
-Mooney M20
-New England Scenery
Fine Print:
**Word of Caution**
My knowledge is limited. Anything I write in my posts may or may not be accurate. To be honest I think its all crap.
User avatar
Flake
VFA-49
VFA-49
Posts: 4375
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 861 times
Been thanked: 1279 times
Contact:

Re: Elevation Grid Generator

Post by Flake »

BARRACUZ wrote:I'm a boob at this
But that's okay because I like boobs. 8-)
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!
User avatar
kiwiflieger
Contributor
Contributor
Posts: 227
Joined: Thu Mar 27, 2014 7:09 am
Favorite Aircraft: Die Fledermaus
Has thanked: 125 times
Been thanked: 92 times

Re: Elevation Grid Generator

Post by kiwiflieger »

BARRACUZ wrote:And if someone can please explain in some detail how to properly use the height amplification.
The height amplification is a multiple of the pixel value, e.g. black (0,0,0) or white (255,255,255). So if the height amp. was set to 20, say, then the height of a white pixel (in metres, of course 8-) ) would be 255 x 20 = 5100 metres.
Currently dormant... playing IL2 Cliffs of Dover
User avatar
DD-Destroyer
Contributor
Contributor
Posts: 323
Joined: Tue May 22, 2012 11:45 pm
Favorite Aircraft: FA-50 Golden Eagle
Location: Seoul
OS: Windows
Has thanked: 4 times
Been thanked: 165 times
Contact:

Re: Elevation Grid Generator

Post by DD-Destroyer »

Thanks. I'll try again. I forgot to tell my PC specification

1. OS : Windows 10 64bit
2. CPU : Intel Skylake i7-6700k with quad core and 4.0Ghz clock
3. VGA : nVidia Geforce GTX 1080
4. RAM : 8G
User avatar
Flake
VFA-49
VFA-49
Posts: 4375
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 861 times
Been thanked: 1279 times
Contact:

Re: Elevation Grid Generator

Post by Flake »

Also, for your viewing pleasure BARRACUZ: viewtopic.php?p=86162#p86162
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!
User avatar
DD-Destroyer
Contributor
Contributor
Posts: 323
Joined: Tue May 22, 2012 11:45 pm
Favorite Aircraft: FA-50 Golden Eagle
Location: Seoul
OS: Windows
Has thanked: 4 times
Been thanked: 165 times
Contact:

Re: Elevation Grid Generator

Post by DD-Destroyer »

I got what is the problem. I think grigor have to add "7. Don't click or change to other program in actual before process completely finish." This script reflex screen in actual and start from left top point of the window to as image file's pixel.
User avatar
Barr
Veteran
Veteran
Posts: 1012
Joined: Wed Mar 28, 2012 8:49 pm
Favorite Aircraft: The Boeing 757
Location: Providence, Rhode Island
OS: Windows 10/Gentoo
Has thanked: 272 times
Been thanked: 206 times

Re: Elevation Grid Generator

Post by Barr »

OfficerFlake wrote:Also, for your viewing pleasure BARRACUZ: viewtopic.php?p=86162#p86162
Ok so if im understading the max elevation in the bitmap must be 255 white? It cant be a max of like 180,43,189.

Or is there a way to scale a maps elevation when the highest point in the bitmap is not a 255 white? This what ive been trying to understand. If you cant then its a real bummer since youll need to edit alot when you pull elevation maps of gis sites
Image
Beginner ATC for hire!
Current Projects:
-Pilatus PC12
-Mooney M20
-New England Scenery
Fine Print:
**Word of Caution**
My knowledge is limited. Anything I write in my posts may or may not be accurate. To be honest I think its all crap.
User avatar
kiwiflieger
Contributor
Contributor
Posts: 227
Joined: Thu Mar 27, 2014 7:09 am
Favorite Aircraft: Die Fledermaus
Has thanked: 125 times
Been thanked: 92 times

Re: Elevation Grid Generator

Post by kiwiflieger »

Just did some testing and determined that the equation for grid face height is always:

pixel brightness (0-255) * height amplification = final grid height

The maximum pixel value doesn't have to be 255 and the scaling is only determined by the brightness of an individual pixel, not the maximum value anywhere on a bitmap.
BARRACUZ wrote:Or is there a way to scale a maps elevation when the highest point in the bitmap is not a 255 white? This what ive been trying to understand. If you cant then its a real bummer since youll need to edit alot when you pull elevation maps of gis sites
Normally, I find the highest pixel value in the bitmap, and then find its elevation on a map. Then just divide elevation of highest point by pixel value and you have the height amplification value.
Example:
Say I'm using this image:
Image
(a random bit of NZ I picked out) and the highest point is somewhere in the bottom right corner. I'd find the elevation on a map and calculate accordingly. ( I think the amplification is something around 15 on this example)

NB all measurements are in metres!
Currently dormant... playing IL2 Cliffs of Dover
User avatar
Barr
Veteran
Veteran
Posts: 1012
Joined: Wed Mar 28, 2012 8:49 pm
Favorite Aircraft: The Boeing 757
Location: Providence, Rhode Island
OS: Windows 10/Gentoo
Has thanked: 272 times
Been thanked: 206 times

Re: Elevation Grid Generator

Post by Barr »

kiwiflieger wrote:Just did some testing and determined that the equation for grid face height is always:

pixel brightness (0-255) * height amplification = final grid height

The maximum pixel value doesn't have to be 255 and the scaling is only determined by the brightness of an individual pixel, not the maximum value anywhere on a bitmap.
BARRACUZ wrote:Or is there a way to scale a maps elevation when the highest point in the bitmap is not a 255 white? This what ive been trying to understand. If you cant then its a real bummer since youll need to edit alot when you pull elevation maps of gis sites
Normally, I find the highest pixel value in the bitmap, and then find its elevation on a map. Then just divide elevation of highest point by pixel value and you have the height amplification value.
Example:
Say I'm using this image:
Image
(a random bit of NZ I picked out) and the highest point is somewhere in the bottom right corner. I'd find the elevation on a map and calculate accordingly. ( I think the amplification is something around 15 on this example)

NB all measurements are in metres!
Okay so now you have me at pixel brightness. A quick Google search and I think I need to find a way to convert the bitmap to a true grey scale image and not just use the "black and white" color function.
Image
Beginner ATC for hire!
Current Projects:
-Pilatus PC12
-Mooney M20
-New England Scenery
Fine Print:
**Word of Caution**
My knowledge is limited. Anything I write in my posts may or may not be accurate. To be honest I think its all crap.
User avatar
Flake
VFA-49
VFA-49
Posts: 4375
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 861 times
Been thanked: 1279 times
Contact:

Re: Elevation Grid Generator

Post by Flake »

kiwiflieger wrote:pixel brightness (0-255) * height amplification = final grid height
So basically what I've been saying this whole time.

I mean, have I explained this poorly or...?

---
BARRACUZ wrote:It cant be a max of like 180,43,189?
You could do that. The height is based of the LUMINANCE value of the pixel, Colors are irrelevant.

Colors can be defined by Red, Green, Blue, or Hue, Saturation, Luminence. Full white is 255 luminence, regardless of hue and saturation levels. Full black is 0 luminence, regardless of hue and saturation. It would be best to think of the light level in regards to luminence.

I tried explaining in RGB as this is what everyone is most familiar with.

You could use colors but they would have NO impact on the grid height - just the luminance of the pixel is all that matters.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests