• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

AeroFly FS 2 support in scenProc

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
Hi Dave,

Detecting forest I have quite good results with. I have used that technique in a few sceneries already. In my experience it works best if you can get imagery including a NIR band for the area.

The improvements to also detect buildings are still in progress. I have some interesting results for that, but the improvements are not yet in the development release. To be honest I was interrupted a bit with this development, so it has been on hold for a while.
 
Messages
121
Country
us-california
@arno,
Thanks as always for a quick response. Sorry to ask about the building detection every so often - I would sure be glad to help beta test anything you come up with.

I want to use the vegetation detection for now but I want to use the BMP files that I have from FSEarthTiles - do I need to find a way to convert to GeoTiff or can I just input a BMP and supply the NW-SE corner points or equivalent?

EDIT: OK, I think I just use the INF file from FsEarthTiles
Thanks

Dave W.
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
Yes, you should be able to use the inf file. Let me know if there are issues, because I don't test that feature so often.
 
Messages
121
Country
us-california
@arno,
OK - I have a shapefile (veg_trees.shp and DBF, PRJ, and SHX) now that supposedly has polygons around my detected trees. And I can ImportOGR that shapefile. Now what? How do I use it for Create AF2Plant?

EDIT: One solution is to read in the SHP file into JOSM ( with plugin "opendata") and then output to OSM format. Then I can read that in as well as the standard OSM for that area. I used the Histogram filter approach for the detection filter and it worked very well!

Thanks
Dave W.
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
Hi Dave,

No need to go to OSM first. You can just load the SHP into scenProc. In the DetectFeature step you assigned an attribute that you can now use to select them again.

Then you will need to scatter points inside the polygon, like you did with OSM data. And output it as AF2Plants. That part has not changed. So in the step that places the points in the polygon you need to select your detected data, instead of the OSM one (that will have natural=forest or so).
 
Messages
24
Country
ukraine
Hi Arno,
Is it possible to enhance the CreateAF2Building step by specifying the name of the argument that contains information about the number of floors of a building (for OSM data "building:levels")? Currently it looks like this:

CreateAF2Building|building="*" And FAREARAT>0.7 And FLENGTH >= 12 And FLENGTH < 25|3|gable|residential

I would suggest:
CreateAF2Building|building="*" And FAREARAT>0.7 And FLENGTH >= 12 And FLENGTH < 25|building:levels|gable|residential

Or even better:
CreateAF2Building|building="*" And FAREARAT>0.7 And FLENGTH >= 12 And FLENGTH < 25|building:levels;3|gable|residential

In the latter variant, the value of the floor argument is taken from the attribute "building:levels", if the value is absent or "0", the fixed value "3" will be used.​
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
Hi,

Yes, I can change that. Reading an attribute instead of a value is not so hard to add. I need to check for the default value, that might be more tricky to do.
 
Messages
211
Country
france
Hi Arno,

Strange behaviour of "CreateAF2Plant" filter detected... for example on my shapefile:

Code:
AddAttribute|(NOT Foret="1") AND (NOT Urbain="1") AND (NOT Aride="1") AND (NOT Aride="2") AND (NOT Eau="*")|String;Other|1
give -> Added attribute to 34437 features

and

Code:
CreateAF2Plant|(NOT Foret="1") AND (NOT Urbain="1") AND (NOT Aride="1") AND (NOT Aride="2") AND (NOT Eau="*")|10;25|broadleaf
give -> Created 112716 plants

(the first one seems to be correct)
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
I'll do some testing. You think some points are selected multiple times maybe?
 
Messages
211
Country
france
Out of subject: If you could add a splitgrid step with AFS2 grid system like "SPLITGRID|AFS2Level9|*"

here is a simplified class to work with AFS2 grid and get ref. points for a specific level:

Code:
      public class AFS2_Grid
      {

            public int Level { get; set; }
            private int nb_cellinEarthWidth { get; set; }
            public double Grid_Width { get; set; }
            public PointD[] Ref_points { get; set; }
           
            // constructor
            public AFS2_Grid(int Level)
            {
                // Calculation based on the gross value of the Aerofly FS2 grid that is in a space between 0 and 65536

                // calculation of number of cells contained in the width of the globe according to the "Level" requested
                this.Level = Level;
                this.nb_cellinEarthWidth = (int)Math.Pow(2, Level);
                double EarthValuMax = 65536.0;

                // this time the width and height is no longer expressed in degrees but in decimal units compared to the grid with conversion
                this.Grid_Width = EarthValuMax / nb_cellinEarthWidth;

                // initialize the array which will contain the set of points corresponding to the lower left corners of each cells of the grid
                this.Ref_points = new PointD[nb_cellinEarthWidth + 1];

                for (int i = 0; i < nb_cellinEarthWidth + 1; i++)
                {
                    double point = this.Grid_Width * i;
                    double[] coord = LonLatFromWorldGrid(new double[2] { point, point });
                    this.Ref_points[i] = new PointD(coord[0], coord[1]);
                }
            }
           
            // other functions
            public double WorldGridConstantA = 2.3311223704144;
            public int TM_PI = 180;

            public string GetWorldGridName_FromLonLat(PointD point)
            {
                int nb_cellinEarthWidth = (int)Math.Pow(2, 16);

                double x = point.X / TM_PI;
                double y = point.Y / TM_PI;
                y = Math.Tan(WorldGridConstantA * y) / WorldGridConstantA;
                x = 0.5 + 0.5 * x;
                y = 0.5 + 0.5 * y;
                double[] coord = new double[2] { nb_cellinEarthWidth * x, nb_cellinEarthWidth * y };

                // then convert x and y to hexadecimal to have the write corresponding to the file name
                string name = Convert.ToInt32(coord[0]).ToString("X") + "_" + Convert.ToInt32(coord[1]).ToString("X");
                return name;
            }

            public double[] GetWorldGrid_FromLonLat(Double[] point)
            {
                int nb_cellinEarthWidth = (int)Math.Pow(2, 16);

                double x = point[0]/ TM_PI;
                double y = point[1] / TM_PI;
                y = Math.Tan(WorldGridConstantA * y) / WorldGridConstantA;
                x = 0.5 + 0.5 * x;
                y = 0.5 + 0.5 * y;
                return new double[2] { nb_cellinEarthWidth * x, nb_cellinEarthWidth * y };
            }

            private double[] LonLatFromWorldGrid(double[] world_grid)
            {
                int nb_cellinEarthWidth = (int)Math.Pow(2, 16);

                double x = world_grid[0] / nb_cellinEarthWidth;
                double y = world_grid[1] / nb_cellinEarthWidth;

                x = 2.0 * (x - 0.5);
                y = 2.0 * (y - 0.5);
                y = Math.Atan(WorldGridConstantA * y) / WorldGridConstantA;
                x *= TM_PI;
                y *= TM_PI;
                return new double[2] { x, y };
            }
           
        }
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
Thanks for the test file, I try with that. Didn't have the time yesterday evening to look at this.

Good idea to add the AF2 grid levels to SplitGrid, I'll add that to the wishlist.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
Hi,

I have found the bug. When features are selected with the AF2 steps a copy of the feature is made for exporting. But this copy was selected again if you have multiple instances of the AF2 steps. So that's why your count was weird. I have fixed it now and the fix will be in the next development release.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
Out of subject: If you could add a splitgrid step with AFS2 grid system like "SPLITGRID|AFS2Level9|*"

here is a simplified class to work with AFS2 grid and get ref. points for a specific level:

I'm a bit confused by this code. From what I read in the AF2 SDK I thought the AF2 grid is just dividing the earth in rectangles. Level 0 the rectangle covers the entire earth and each time it is split in 4 rectangles of half the size. But your code seems more complex. Did I misunderstand something?
 
Messages
211
Country
france
Sorry I did not want to confuse you Arno ...
Your explanation is good, the earth is divided into 4 cells at each level. I took this path but it may not be the easiest. My understanding of this type of grid and projection systems is very limited. Follow your path is surely the best ;)
 
Messages
211
Country
france
Hi,

I have found the bug. When features are selected with the AF2 steps a copy of the feature is made for exporting. But this copy was selected again if you have multiple instances of the AF2 steps. So that's why your count was weird. I have fixed it now and the fix will be in the next development release.
thank you Arno :)
 
Messages
211
Country
france
Hi Arno,

could you add an option to specify "species" into "CreateAF2Plant" step please ?
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
Sure, but which values are allowed? Is there any documentation about this?
 
Messages
211
Country
france
no documentation but experimentation ;)

depend of plants filename, for example:
"plant_broadleaf_01_1650_color.ttx" -> group: "broadleaf" and species:"01_1650"

may be : 01 for type ? and 1650 is about the height of the plant (16,50 metrer) and it seems that if species are not specify, this work like FSX grouping and the simulator get species randomly...


have a look here: Aerofly FS 2 Flight Simulator\scenery\plants
 
Top