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

SubtractFeatures Issue

Messages
13
Country
us-mississippi
Hello!

First off, Arno I'd like to thank you for the excellent tool that Scenproc is! I have been using it successfully, up til now that is. I can't figure out what I am doing wrong, so hopefully someone can provide some guidance.

Here's the scoop:

I have a .shp file of the roads for a city. I converted all the roads from lines to actual polygons. I also have .shp file of "detected" buildings that I created using the detectfeatures function of scenproc. The detectfeatures .shp file happend to falsely detect buildings directly on all the major highways (because of the same color). Anyways, I am trying to use the SubtractFeatures to remove the buildings from all the roads. Here is the SubtractFeatures code excerpt:

SubtractFeatures|FTYPE=POLYGON;FROMFILE=Building_Outlines.shp|FTYPE=POLYGON;FROMFILE=ROADSPOLYGONS.shp;polygons=road|10|MINAREAPOLY

This simply is not working after it creates the autogen. I load FSX and the buildings are still there. I've also tried the code swapped around:

SubtractFeatures|FTYPE=POLYGON;FROMFILE=ROADSPOLYGONS.shp;polygons=road|FTYPE=POLYGON;FROMFILE=Building_Outlines.shp|10|MINAREAPOLY

Still nothing. I have double and triple checked that the correct file names, attribute names, and values. I am really scratching my head with this one. Any help would be greatly appreciated!
 
Hi,

I'm not behind my pc now, but I would check the second to last attribute. I thought it was a percentage to scale up the polygon. So 10 seems a bit high. Also using a minimum area polygon might remove more than you want with complex polygons.
 
Hi Arno,

I forgot to mention that I have also tried the scale attribute at both 1, 2, and 10. Regardless of the scale, the buildings are not being removed from the road polygons.

Not sure if this matters or not, but the road polygons are not fully 100% encompassing the building polygons, and vice versa. Does the SubtractFeatures work with polygons that are partially ecompassed by each other?

Thanks!
 
Yes, it should work in the situation you describe. Let me see if I can setup a similar test situation or do you have some sample files?
 
Thanks for the reply,

Here are all the files that you should need to test this yourself, including a small satellite texture bgl file so that once the AGN is created, you can use the Autogen Annotator to quickly view the results.

Here is the zip folder with the files (.shp, .bgl, .spc)
https://www.mediafire.com/?e5tb3gttla1lqzg

Let me know what you think!

Thanks
 
Hi,

I (finally) had a look at your data. The main problem was that you did the subtract features step last. That way it didn't affect the autogen being created. The general workflow is first load the data, then do processing on it and then create autogen.

I have modified your script a bit and also removed some other unneeded steps. Below is the new version where the subtract works fine:

Code:
# IMPORT DATA
IMPORTOGR|Building_Outlines.shp|*|*|NOREPROJ
IMPORTOGR|ROADSPOLYGONS.shp|*|*|NOREPROJ

# SPLIT IN AUTOGEN GRID (KEEP BUILDING SHAPES AS ONE PIECE)
SPLITGRID|AGN|*|FROMFILE=Building_Outlines.shp

# REMOVE OBJECTS FROM ROADS
SubtractFeatures|FTYPE=POLYGON;FROMFILE=Building_Outlines.shp;Type=*|FTYPE=POLYGON;FROMFILE=ROADSPOLYGONS.shp|1

# ADD BUILDING ATTRIBUTES
ADDATTRIBUTE|FTYPE=POLYGON;FROMFILE=Building_Outlines.shp;Type=SeaBldgs;FAREARAT>0.80|BUILDTYPE|1
ADDATTRIBUTE|FTYPE=POLYGON;FROMFILE=Building_Outlines.shp;Type=SeaBldgs;BUILDTYPE!1;FNUMVERT<10;FNUMPERPANG>3;FNUMNOTPAR<2|BUILDTYPE|3
ADDATTRIBUTE|FTYPE=POLYGON;FROMFILE=Building_Outlines.shp;Type=SeaBldgs;BUILDTYPE!1;BUILDTYPE!3;FCONVEX=1|BUILDTYPE|4
ADDATTRIBUTE|FTYPE=POLYGON;FROMFILE=Building_Outlines.shp;Type=SeaBldgs;BUILDTYPE!1;BUILDTYPE!3;BUILDTYPE!4|BUILDTYPE|5

# SPLIT COMPLEX FOOTPRINTS
REPLACEPOLYGONBYBUILDINGRECTANGLES|BUILDTYPE=3|0.8;4;4|0.25;2.0;0.5|BUILDTYPE|2

# CREATE AUTOGEN
CREATEAGNPOLYVEG|FTYPE=POLYGON;FROMFILE=Building_Outlines.shp;Type=SeaTrees|{e8b937fd-a1f2-4bd5-8548-2c80d30102af}
CREATEAGNGENBUILD|BUILDTYPE<2|{5ae04eb6-934c-4f63-bb48-5e7dee601212}|MAXRATIO=2

EXPORTAGN|FSX|C:\Users\arno\downloads\test\texture
 
Back
Top