• 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.

AddAttributeIfInside step with complex polygons? (no prefix = AFS2)

Messages
58
Country
switzerland
Dear Arno,

I've been trying for a while to create a cultivation file for Switzerland, with differents sets of buildings depending on the regions (cultivation is AFS2's equivalent for Autogen, works similar).
I'm working with OSM data from Geofabrik.de (switzerland-latest.osm, 5.5 GB)

I first defined several sets of KML polygons for regions as follows :


Note: The part of the country without regional KML (Mainland & Jura range) will be simply assigned a base set of buildings.

Then, I made 1 SPC setup for each region, i.e. 5 SPC files, each based on the same steps, but dedicated to a specific region :

1) load the osm data, limited to interesting features:
Code:
ImportOGR|K:\XXX\switzerland-latest.osm|*|building;highway;aeroway;man_made|NOREPROJ
2) load the polygons with steps like
Code:
ImportOGR|K:\XXX\zone_Alpes_N_High.kml|*|*|NOREPROJ
Additionally, I also load exclusion polygons for aerodromes or whatever

3) SplitGrid
Code:
SplitGrid|0.4;0.2|5.6;10.5;45.8;48|building="*"
4) Add a default attribute to every building
Code:
AddAttribute|building="*" |String;inboundary|no
5) Add a specific attribute to buildings belonging to the region
Code:
AddAttributeIfInside|building="*"|FROMFILE="zone_Alpes_N_High.kml"|String;inboundary|yes
6) Create buildings with proper attribute
Code:
CreateAF2Building|building="*" And inboundary="yes" And...
7) Export as TOC file
Code:
ExportTOC|K:\XXX|cultivation_Alpes_Nord_High

The steps work, but I have troubles with the AddAttributeIfInside step and my polygons.

Below are displayed the resulting non-empty cultivation tiles for each region, it clearly shows that some tiles that should be excluded were generated, while some other tiles that should belong to the region were excluded :

The Alpine range from my SPC example above:


Eastern range


Northern Alpine range


Southern Alpine range


Mainland + Jura



How does the AddAttributeIfInside step computes if inside a polygon, are there limitations, like the need for convex-only polygons? Or is there a limit in the number of vertices for a polygon? Or should I use something different for regional polygons?
Note : The AddAttributeIfInside step works nicely for my aerodrome excludes, as far as I could see.

Attached are my ScenProc settings and the resulting log files

I tried several other methods, like first unloading features that don't belong to the region, but since the filter itself fails, it unloads undue data and leave other data that should be removed.

Thank you in advance for your support, I really love ScenProc

Cheers
Antoine
 

Attachments

check your table attributed for these items;
make sure the objects inside are tagged as buildings or add a filter to include them as well,
 
Thank you for the tip. I checked a few mistakenly filtered of them and the buildings attributes are ok.

Cheers
Antoine
 
Actually, if we look at the tiles, they're getting created and the buildings inside are generated, but in some cases not in the appropriate category. Some buildings get generated in the wrong region. Or the same building get generated in 2 different regions...

The issue really seems to lay by The AddAttributeIfInside filter...

Cheers
Antoine
 
Last edited:
not sure i follow!
buildings are randomly generated by sim, you only place a footprint for sim to generate an object in that place,
building will vary in shape and size based on population density factors and the ratio for the type you set initially,
each time you run sim they will be different and possibly duplicated as your view fills in,
 
No, nothing random : I'm placing cultivation buildings, with specific placement, shape, size, etc.
Depending on the region, I attribute them a specific shape and texture set...
 
i think we are loosing something in translation here :)
what do you mean by "cultivation buildings"?
custom buildings maybe?
 
That's what I think, unless I missed something when defining my steps.
Computing coordinates appartenance to the inside of a polygon is not totally trivial when it comes to handle complex, concave polygons. As the case may be there are some limitations to cope with. Or a bug... hope Arno can have a look at it when he has some time.

Cheers
Antoine
 
Hi Antoine,

Could it be the issue is those tiles that are in different regions? If you process each region seperately they might be overwritten.
 
Hi Arno, thank you for taking care of my issue.
I process each region separately, with a specific spc file. They're not getting overwritten since each region generates a set of cultivation files with a specific prefix in the name. All tiles are thus getting generated for each region, but some tiles are empty since all buildings (and lights, because I'm also processing lights) were filtered out, duly or not.)
The problem seems to lay by the filtering...
I deleted empty tiles.

Cheers
Antoine

Envoyé de mon SM-G935F en utilisant Tapatalk
 
Can you show the log of your run? Maybe that can give some more clues.
 
Hi,

Sorry, missed that attachment as I was reading the forum from my phone.

Apart from the fact that the inboundary="no" is not set correctly for the point features (points="*" vs point="*" in your script), I don't see anything weird in your script.

Maybe it would help to export the buildings to a SHP file after you have set the attributes? Just to check if all the buildings you expect get inboundary="yes".
 
Thanks for pointing out the point syntax error. It only matters for lights, but it was a mistake...

Envoyé de mon SM-G935F en utilisant Tapatalk
 
Ok, I compiled the Mainland (plaine) part as shapefiles.

I gave region-specific attributes to be able to identify those that would not get filtered:

Code:
AddAttribute|building="*" |String;outboundary|no
AddAttribute|point="*" |String;outboundary|no
AddAttributeIfInside|building="*"|FROMFILE="zone_Alpes_E_Medium.kml"|String;outboundary|Alpes_E
AddAttributeIfInside|point="*"|FROMFILE="zone_Alpes_E_Medium.kml"|String;outboundary|Alpes_E
AddAttributeIfInside|building="*"|FROMFILE="zone_Alpes_N_High.kml"|String;outboundary|Alpes_NH
AddAttributeIfInside|point="*"|FROMFILE="zone_Alpes_N_High.kml"|String;outboundary|Alpes_NH
AddAttributeIfInside|building="*"|FROMFILE="zone_Alpes_N_medium.kml"|String;outboundary|Alpes_NM
AddAttributeIfInside|point="*"|FROMFILE="zone_Alpes_N_medium.kml"|String;outboundary|Alpes_NM
AddAttributeIfInside|building="*"|FROMFILE="zone_Alpes_S_High.kml"|String;outboundary|Alpes_S
AddAttributeIfInside|point="*"|FROMFILE="zone_Alpes_S_High.kml"|String;outboundary|Alpes_S
#
UnloadFeatures|outboundary="Alpes_E"
UnloadFeatures|outboundary="Alpes_NH"
UnloadFeatures|outboundary="Alpes_NM"
UnloadFeatures|outboundary="Alpes_S"
#

Code:
ExportOGR|FTYPE="POLYGON"|ESRI Shapefile|K:\XXX\cultivation_plaine.shp|layerName|ADDSPECIALATTR

As a result, the problem obviously lays by the regions polygons and the AddAttributeIfInside step.

This first picture shows all the shp layers of the "cultivation_plaine" compilation. Black are buildings polygons.
Note the Alpes North High and Medium region polygons are visible, but buildings are only excluded in some Tiles.
Note the Alpes East and South region polygons are only very partly visible, as if not entirely loaded in ScenProc...



The next picture shows the same, but I added my regions KLM polygons in transparency. All buildings should be removed from coloured areas, which is obviously not the case.


Here are details, with only very partial filtering from coloured areas.



Looking at the attributes table in QGIS, all featured buildings in the shapefiles have the attribute outboundary set to "no", meaning that all buildings that had a different value for outboundary were effectively discarded (this is correct).
In other words, the problem actually lays by setting the attribute to each building based on region polygons. Some (many) buildings don't get the proper attribute (their building = "yes" attribute is however correct).

I attached again my exclusion polygons archive, containing also the regions. Is there anything wrong with my polygons ?

Thanks in advance
Cheers
Antoine
 

Attachments

Last edited:
Did you use the SplitGrid step in this last test as well?

I'll try to reproduce it when I'm behind my FS PC.
 
Back
Top