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

ImportAGN, SubstractFeature from Shapefile, ExportAGN possible?

Messages
118
Country
france
Hi,

I'm trying to process big areas in 2 passes for memory constraints, then I tried to subtract roads to vegetation AGNs already build during a 1st pass. I think it's not working, so maybe I'm wrong on the method.
I verified that some AGN files are effectively modified after the process (from date/time tag).

The steps are below:

Code:
#
IMPORTOGR|D:\Roads.shp|*|*|AUTODETECT
#
# extrude roads
LineToPolygon|FTYPE="LINE" and fclass="motorway" and tunnel<>"T"|25|String;polygons|roadpoly
#
# Free memory
UnloadFeatures|FTYPE="LINE"
#
# Import vegetation AGN
ImportAGN|D:\VEG|CREATEFEATURES
#
# Substract road polygons from vegetation
SUBTRACTFEATURES|*|polygons="roadpoly"|1.0
#
# Free memory
UnloadFeatures|polygons="roadpoly"
#
SplitGrid|AGN|*
#
# Save modified AGN
ExportAGN|P3D v2|D:\VEG

Thanks

Roland
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
30,637
Country
netherlands
Hi,

I don't see a SplitGrid step. So that means your roads and imported agn files are probably in different grid cells.
 
Messages
118
Country
france
Hi Arno,
There is a SplitGrid step before ExportAGN.
Actually if I forget SplitGrid command, ScenProc script parser raises an error.

However do you mean the SplitGrid step must be done before Substract? Before ImportAGN or after?
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
30,637
Country
netherlands
It should be before the subtract step. Probably best to put it directly after the ImportOGR.
 
Messages
118
Country
france
I continued my tests and unfortunately the SubstractFeatures() from loaded AGN still does not work.

I have added attributes to my vegetation AGNs so I'm sure that the SubstractFeature applies to the vegetation.
I compare the byte sizes of my AGN folder before and after, and as they are perfectly equal I'm pretty sure the script did not modify anything.

Here is how the script looks like now:

Code:
# Import roads lines
IMPORTOGR|D:\Roads.shp|*|*|AUTODETECT
#
# Import vegetation AGN
ImportAGN|D:\VEG|CREATEFEATURES
AddAttribute|FTYPE<>"LINE"|String;polygons|vegpoly
#
# extrude roads along fclass
LineToPolygon|FTYPE="LINE" and fclass="motorway" and tunnel<>"T"|25|String;polygons|roadpoly
LineToPolygon|FTYPE="LINE" and fclass="trunk" and tunnel<>"T"|25|String;polygons|roadpoly
LineToPolygon|FTYPE="LINE" and fclass="primary" and tunnel<>"T"|15|String;polygons|roadpoly
LineToPolygon|FTYPE="LINE" and fclass="secondary" and tunnel<>"T"|12|String;polygons|roadpoly
LineToPolygon|FTYPE="LINE" and fclass="tertiary" and tunnel<>"T"|10|String;polygons|roadpoly
#
# Free memory
UnloadFeatures|FTYPE="LINE"
#
SplitGrid|AGN|*
#
# Substract road polygons from vegetation
SUBTRACTFEATURES|polygons="vegpoly"|polygons="roadpoly"|1.0|MINAREAPOLY
#
# Save
ExportAGN|P3D v2|D:\VEG
 
Messages
118
Country
france
Well, I'll find another way to do that. I think it's not possible this way.
Let's go around the obstacle ;)
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
30,637
Country
netherlands
Hi,

After you subtract the polygons you need to create new agn polygons. The subtract works on the features, not on the agn.

But I guess you then need a way to unload the original agn first and that option is probably not there now.
 
Top