Board index FlightGear Development Scenery

Coverage of the current material regions in FGDATA

Questions and discussion about enhancing and populating the FlightGear world.

Coverage of the current material regions in FGDATA

Postby ludomotico » Tue Mar 31, 2020 7:22 pm

For the convenience of the scenery developers and as an external tool, I've created a small script that reads the XML files in FGDATA/Materials/regions and plots the coverage of the currently defined regions.

- The project can be found here: https://github.com/Juanvvc/plot_regions
- The coverage files can be found here: https://github.com/Juanvvc/plot_regions ... er/regions
- The materials can be found here: https://github.com/Juanvvc/plot_regions ... /materials

As an example, this is the coverage of FGDATA/Materials/regions/caribbean.xml

Image

As another example, this is the status of all our regional materials. As you know, the priority of the overlapping regions is as listed in FGDATA/Materials/regions/materials.xml

Image

I've also included the link to the output in the "related content" section of the wiki, for your convenience: http://wiki.flightgear.org/Howto:Regional_texturing

During the development of this little experiment, I also detected some small bugs and things that are probably not as intended:

- There is an extra "-" sign in the lon1 parameter of https://sourceforge.net/p/flightgear/fg ... aneiro.xml that probably prevents this file to work correctly.
- the subareas defined in brazil_mata_atlantica.xml are probably sub-optimal: https://github.com/Juanvvc/plot_regions ... ca.xml.png
- the area covered by madagascar.xml is probably slightly displaced to the west: https://github.com/Juanvvc/plot_regions ... ar.xml.png

I hope this tool is useful!
Last edited by ludomotico on Wed Apr 01, 2020 11:29 pm, edited 3 times in total.
User avatar
ludomotico
 
Posts: 1101
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux

Re: Coverage of the current material regions in FGDATA

Postby wlbragg » Tue Mar 31, 2020 8:31 pm

Really nice, thank you for the effort!
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5593
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Coverage of the current material regions in FGDATA

Postby frtps » Tue Mar 31, 2020 11:18 pm

Now that is what I call a useful tool. It will be immediately useful for checking the way Australian regions are being divided up.
frtps
 
Posts: 103
Joined: Sun Aug 05, 2018 9:58 am

Re: Coverage of the current material regions in FGDATA

Postby stuart » Wed Apr 01, 2020 1:34 pm

That's a great visualization. Great to see what's been done.
G-MWLX
User avatar
stuart
Moderator
 
Posts: 1553
Joined: Wed Nov 29, 2006 9:56 am
Location: Edinburgh
Callsign: G-MWLX

Re: Coverage of the current material regions in FGDATA

Postby Thorsten » Wed Apr 01, 2020 2:20 pm

This is pretty cool!

May I ask whether it's possible to do that 'per material' as well, so that we can visualize where definitions override each other? Because I found such a check very hard to do manually (sometimes it's really hard to determine which file needs to be edited, the South America definitions are really... a bit special in that respect).
Thorsten
 
Posts: 11639
Joined: Mon Nov 02, 2009 8:33 am

Re: Coverage of the current material regions in FGDATA

Postby ludomotico » Wed Apr 01, 2020 10:14 pm

May I ask whether it's possible to do that 'per material' as well, so that we can visualize where definitions override each other?


Very fun challenge!

Results: https://github.com/Juanvvc/plot_regions ... /materials

Priorities (i.e., rectangles on top) are as I understand FlightGear manages them: last files listed in materials.xml have higher priority.

In this case, we want to identify which regions are on top of others, and then "alpha=1" and "edgecolor=gray" seem appropriate.

Examples:

Code: Select all
python3 plot_regions.py \
    --single --legend --material DeciduousNeedleCover \
    --edgecolor gray --alpha 1 \
    $FG_ROOT/Materials/regions


Image

You can also focus on an area, or change the color of the world shape:

Code: Select all
python3 plot_regions.py \
    --single --legend --material IrrCrop \
    --edgecolor gray --alpha 1 --worldcolor black \
    --boundaries '[-30, 45, 30, 70]' \
    $FG_ROOT/Materials/regions


Image

Colors are random. If two adjacent regions have similar colors, run again and maybe you'll get better colors.
User avatar
ludomotico
 
Posts: 1101
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux

Re: Coverage of the current material regions in FGDATA

Postby ludomotico » Wed Apr 01, 2020 10:59 pm

The last image shows the confusion that regions and priorities can create:

- Tunisian scenery creators may be not aware that their carefully crafted IrrCrop material included in africa_mediterranean.xml is overwritten by europe.xml, not southern_europe.xml. As you can see on the other image, no other region overwrites DeciduousNeedleCover for Tunisia. As a result, they can change one material (DeciduousNeedleCover ) but not the other (IrrCrop) Maybe, regions in materials.xml should be organized by coverage extension and not continents, as they are organized now (any region in Europe has higher priority than any region in Africa) If I understood priorities correctly.
- IrrCrop in Cyprus is defined in middle_east.xml, europe.xml and the default, non regional materials, depending on which part of the island you are. You may think that creating a custom region for Cyprus might by a solution, but if it is classified as "Europe" in materials.xml, any region in Middle East has higher priority than Europe and a custom region for Cyprus won't be able to change some parts of the island.

Also, filenames may be misleading. Which area do you think mediterranean_cities.xml covers? Check: https://github.com/Juanvvc/plot_regions ... es.xml.png
User avatar
ludomotico
 
Posts: 1101
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux

Re: Coverage of the current material regions in FGDATA

Postby Thorsten » Thu Apr 02, 2020 6:26 am

Oh yeah, that's very helpful! Thanks a lot for accepting teh challenge!
Thorsten
 
Posts: 11639
Joined: Mon Nov 02, 2009 8:33 am

Re: Coverage of the current material regions in FGDATA

Postby Johan G » Thu Apr 02, 2020 9:30 am

@ludomotico: Could you mention this in the April newsletter with some illustrations. I think they will also be useful for the Howto:Regional texturing article.
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5779
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: Coverage of the current material regions in FGDATA

Postby ludomotico » Thu Apr 02, 2020 10:56 am

Johan G wrote in Thu Apr 02, 2020 9:30 am:@ludomotico: Could you mention this in the April newsletter with some illustrations. I think they will also be useful for the Howto:Regional texturing article.


I will mention it in the newsletter, and the results are already linked in "related content" of "Regional texturing"
User avatar
ludomotico
 
Posts: 1101
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux

Re: Coverage of the current material regions in FGDATA

Postby wlbragg » Thu Apr 02, 2020 2:52 pm

For clarity, on the last image, am I seeing that irregular crop is overlapping irregular crop in a higher priority definition? In at least one case as many as three deep?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5593
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Coverage of the current material regions in FGDATA

Postby Hooray » Thu Apr 02, 2020 3:51 pm

nice idea, this should be added to the newsletter/wiki respectively - feel free to upload the corresponding screen shots to the wiki :D
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11836
Joined: Tue Mar 25, 2008 8:40 am

Re: Coverage of the current material regions in FGDATA

Postby ludomotico » Thu Apr 02, 2020 5:34 pm

wlbragg wrote in Thu Apr 02, 2020 2:52 pm:For clarity, on the last image, am I seeing that irregular crop is overlapping irregular crop in a higher priority definition? In at least one case as many as three deep?


(I always believed that IrrCrop stands for Irrigated Crops!)

If I understood correctly, the algorithm is in https://sourceforge.net/p/flightgear/si ... b.cxx#l154 and it goes like this:

Code: Select all
   def find(material, position)
      region_list = get_regions_defining(material)
      for each region in reversed region_list:   #<  last region in materials.xml has higher priority
        if region.includes(position):
           return region


i.e., for a given position and material, first gets all XML files that define this material and then looks for the last (as listed in materials.xml) region which includes your position. Keep in mind the assumption made in this file, as the comment says ("as the materials list is ordered with the smallest regions at the end."), is not right because regional materials in materials.xml are ordered by continent, not size, which certainly adds some confusion as in the case of Tangier/Oran/Argiers/Tunis.

As a result, in those areas with many regions (Europe, South America), you might find that several other regions overlap your own, each one with different materials because none of the regions define all materials. Sometimes, it is difficult to identify which specific file is overwriting your materials, because one material might be overwritten by one file and the next by another.

Also, remember there are some "special regions" named "large/mega cities" that are spread all over the world: https://github.com/Juanvvc/plot_regions ... on.xml.png If you are working on your own Urban material for your region, you might find that it apparently works for one city but not for another.

This tool tries to assist you on identifying which regions overlap, and which materials are rewritten.

Just for the record, I'm not saying that there is anything wrong in how regional materials are managed. If you are a scenery developer, you must be aware of these issues and, apart from defining your region, include it in the best place of your own copy of materials.xml The "best place" is maybe not "under the section specific for your continent".
User avatar
ludomotico
 
Posts: 1101
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux

Re: Coverage of the current material regions in FGDATA

Postby Thorsten » Thu Apr 02, 2020 8:04 pm

I'm not saying that there is anything wrong in how regional materials are managed.


Okay - I'll say it then - but it's hard to come up with a better scheme that preserves all the freedom there is. :(

But I'd definitely be in favor of ordering the files to make things more transparent, the current structure 'grew' rather than having been designed up-front.
Thorsten
 
Posts: 11639
Joined: Mon Nov 02, 2009 8:33 am

Re: Coverage of the current material regions in FGDATA

Postby www2 » Fri Apr 03, 2020 12:08 am

I see two problems with the current systems:
First problem is that the current system use a box coordinate.
This can be fix using a vector coordinate system instate of the box system
what the current system looks like:
Code: Select all
  <area>
    <lon1>9.0</lon1>
    <lon2>36.0</lon2>
    <lat1>-37.0</lat1>
    <lat2>-21.0</lat2>
  </area>

what the news system looks like:
Code: Select all
<vector_area>
-10.54509670418442,31.56079284897752,0 -17.03064667719349,24.05248434111258,0 -20.19204639655966,14.20751320035382,0 -8.373773999252228,1.032705547824682,0 7.804008950464596,-3.500076822899939,0 14.9377020182103,-40.10949518255281,0 54.23878949370764,-33.06121744321976,0 60.17331913483234,-17.73529902315141,0 51.70831377007291,9.12781867025377,0 51.45502796465173,12.15680593286339,0 43.75394605021918,12.1038536547092,0 42.70020221253494,13.4217251792368,0 37.49199040299624,22.36683367875029,0 34.359334564915,27.56344417317496,0 34.91046916399895,29.44341800858749,0 34.1643768945893,31.42353814675953,0 25.16044403896997,32.6295695537933,0 21.00160698397158,33.06211764104732,0 19.1952113982253,31.39099467579809,0 12.13040813372672,33.92078468189383,0 11.44398845784934,36.98414101835594,0 10.32932708311136,37.39916037220524,0 8.874622515616178,37.34399001584633,0 4.36286809762904,37.0391861494118,0 1.255725620520718,36.67055403943045,0 -2.306226692333524,35.39061833628209,0 -4.21594867781467,35.42593638443726,0 -5.124379576788725,36.03548966057099,0 -6.682904759264159,35.76586636655905,0 -10.54509670418442,31.56079284897752,0
</vector>

For the second problem is the lack of hierarchy.
This solution is east to do using a tree structure where GLOBAL material is on top than come global regions as EURAZIE, AFRICA, North Amarica,etc than are some smallness regions as Northen Europe, South-East Asia,Japan, etc the can be reaped to a region with a size of a large city e.g. Tokyo.
For the rules an material node that are lower in the tree can override a higher material node.
The inverse of this rule is for coordinate coordinates.
If two areas on the same level in the node tree and have the same material overlap than is the rule to blend the two materials.
www2
 
Posts: 267
Joined: Thu Apr 16, 2009 1:58 pm
OS: Ubuntu

Next

Return to Scenery

Who is online

Users browsing this forum: No registered users and 4 guests