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

ReplacePolygonByrectangles problem

MatthiasKNU

Resource contributor
Messages
962
Country
germany
Hello!

I am quite new to ScenProc and I have a problem (which is probably solved very quickly).

First of all, my ScenProc Script:
Code:
ImportOGR|C:\Users\Matthias\Desktop\DUS\OSM\Merged.shp|*|*|AUTODETECT
SplitGrid|AGN|*

ReplacePolygonByVegetationRectangles|FTYPE=POLYGON; FROMFILE=Merged.shp; code=7201|0.001|0.25|0.25
ReplacePolygonByVegetationRectangles|FTYPE=POLYGON; FROMFILE=Merged.shp; code=7202|0.001|0.4|0.25

CreateAGNRectVeg|code=7201|{D3A99E0B-AB45-42BD-A031-AE36248199A0}
CreateAGNRectVeg|code=7202|{8EF6A032-8AA8-48F0-80EA-90A16B3696DD}

ExportAGN|P3D v2|C:\Users\Matthias\Desktop\DUS\Autogen

I want to create just the Autogen vegetation for an area. The information out of the GIS is correct, forests are code 7201, 7202 are parks.

Here is a picture how it looks like in my GIS-Software:
zwischenablage02mguo0.jpg

Green are forests (with code 7201) and the yellow marked areas are parks (with code 7202).

After running ScenProc and openning in the Autogen Annotator I am seeing this:
zwischenablage01ebu2v.jpg

(I tried also something with the buildings in the screenshot above, just don't look at them... :confused:)

What am i doing wrong?
Thank you in advance!
 
Hi, can you also show the scenProc log when running the script? That should help to understand what is going on.
 
Hi,

Can you try without spaces in the filter, I'm not sure that works. I think it might now look for an attribute named " code" instead.
 
Thank you for your answer!

I tried it out, that's the script I used:
Code:
ImportOGR|C:\Users\mknue\Desktop\DUS\OSM\Merge.shp|*|*|AUTODETECT
ImportOGR|C:\Users\mknue\Desktop\DUS\OSM\Roads.shp|*|*|AUTODETECT
SplitGrid|AGN|*
SetAGNBuildingHeight|*|1.0;0.0;0.0;0.0
PlacePointsAlongLine|FTYPE=LINE;FROMFILE=Roads.shp|SINGLE|120;120|7;7|0|OBJECT|LIGHT|HDG
ReplacePolygonByVegetationRectangles|FTYPE=POLYGON;FROMFILE=Merge.shp;code=7201|0.001|0.5|0.3
ReplacePolygonByVegetationRectangles|FTYPE=POLYGON;FROMFILE=Merge.shp;code=7202|0.001|0.5|0.3
ReplacePolygonByVegetationRectangles|FTYPE=POLYGON;FROMFILE=Merge.shp;code=7217|0.001|0.5|0.3
ReplacePolygonByVegetationRectangles|FTYPE=POLYGON;FROMFILE=Merge.shp;code=7210|0.001|0.5|0.3
CreateAGNLibObj|OBJECT=LIGHT|{1f414356-7436-4b12-95c7-ae2d49a2c226}|HDG|0|16;16
CreateAGNGenBuild|FTYPE=POLYGON;FROMFILE=Merge.shp;code=1500;FAREARAT<0.7|{5ae04eb6-934c-4f63-bb48-5e7dee601212}|MAXRATIO=2
CreateAGNGenBuild|FTYPE=POLYGON;FROMFILE=Merge.shp;code=1500;FAREARAT>0.7|{4EB68BE7-2F1F-4cd2-920E-BECFA2D8C888}
CreateAGNRectVeg|code=7201|{8EF6A032-8AA8-48F0-80EA-90A16B3696DD}
CreateAGNRectVeg|code=7202|{D3A99E0B-AB45-42BD-A031-AE36248199A0}
CreateAGNRectVeg|code=7210|{D3A99E0B-AB45-42BD-A031-AE36248199A0}
CreateAGNRectVeg|code=7217|{D3A99E0B-AB45-42BD-A031-AE36248199A0}
ExportAGN|P3D v2|C:\Users\mknue\Desktop\DUS\Autogen

And that's the log file:
Code:
19:43    ImportOGR    Information    Reading file C:\Users\mknue\Desktop\DUS\OSM\Merge.shp
19:43    ImportOGR    Information    Initializing input projection to +proj=longlat +datum=WGS84 +no_defs
19:44    ImportOGR    Information    Initializing input projection to +proj=longlat +datum=WGS84 +no_defs
19:44    ImportOGR    Information    Read 246814 features from file
19:44    ImportOGR    Information    Reading file C:\Users\mknue\Desktop\DUS\OSM\Roads.shp
19:44    ImportOGR    Information    Initializing input projection to +proj=longlat +datum=WGS84 +no_defs
19:44    ImportOGR    Information    Initializing input projection to +proj=longlat +datum=WGS84 +no_defs
19:44    ImportOGR    Information    Read 2699 features from file
19:44    SplitGrid    Information    Splitting features in 0,0146484375 x 0,010986328125 grid...
19:45    SplitGrid    Information    Features divided in 814 cells
19:45    SetAGNBuildingHeight    Information    Setting autogen building heigth...
19:45    SetAGNBuildingHeight    Information    Set autogen building heigth for 813 cells
19:45    PlacePointsAlongLine    Information    Placing point features along lines with filter FTYPE=LINE;FROMFILE=Roads.shp...
19:45    PlacePointsAlongLine    Information    Created 4858 point features
19:45    ReplacePolygonByVegetationRectangles    Information    Replacing polygons with vegetation rectangles for polygons that match filter FTYPE=POLYGON;FROMFILE=Merge.shp;code=7201
19:45    ReplacePolygonByVegetationRectangles    Information    Created 0 vegetation rectangles
19:45    ReplacePolygonByVegetationRectangles    Information    Replacing polygons with vegetation rectangles for polygons that match filter FTYPE=POLYGON;FROMFILE=Merge.shp;code=7202
19:45    ReplacePolygonByVegetationRectangles    Information    Created 0 vegetation rectangles
19:45    ReplacePolygonByVegetationRectangles    Information    Replacing polygons with vegetation rectangles for polygons that match filter FTYPE=POLYGON;FROMFILE=Merge.shp;code=7217
19:45    ReplacePolygonByVegetationRectangles    Information    Created 0 vegetation rectangles
19:45    ReplacePolygonByVegetationRectangles    Information    Replacing polygons with vegetation rectangles for polygons that match filter FTYPE=POLYGON;FROMFILE=Merge.shp;code=7210
19:45    ReplacePolygonByVegetationRectangles    Information    Created 0 vegetation rectangles
19:45    CreateAGNLibObj    Information    Creating autogen library objects with filter OBJECT=LIGHT...
19:45    CreateAGNLibObj    Information    Created 4850 autogen objects
19:45    CreateAGNGenBuild    Information    Creating autogen generic buildings with filter FTYPE=POLYGON;FROMFILE=Merge.shp;code=1500;FAREARAT<0.7...
19:45    CreateAGNGenBuild    Information    Created 25081 autogen objects
19:45    CreateAGNGenBuild    Information    Creating autogen generic buildings with filter FTYPE=POLYGON;FROMFILE=Merge.shp;code=1500;FAREARAT>0.7...
19:46    CreateAGNGenBuild    Information    Created 228863 autogen objects
19:46    CreateAGNRectVeg    Information    Creating autogen rectangular vegetation with filter code=7201...
19:46    CreateAGNRectVeg    Information    Created 0 autogen objects
19:46    CreateAGNRectVeg    Information    Creating autogen rectangular vegetation with filter code=7202...
19:46    CreateAGNRectVeg    Information    Created 0 autogen objects
19:46    CreateAGNRectVeg    Information    Creating autogen rectangular vegetation with filter code=7210...
19:46    CreateAGNRectVeg    Information    Created 0 autogen objects
19:46    CreateAGNRectVeg    Information    Creating autogen rectangular vegetation with filter code=7217...
19:46    CreateAGNRectVeg    Information    Created 0 autogen objects
19:46    ExportAGN    Information    Writing AGN files to folder C:\Users\mknue\Desktop\DUS\Autogen
19:46    ExportAGN    Information    Created 253973 generic buildings objects
19:46    ExportAGN    Information    Created 4858 library objects
19:46    ExportAGN    Information    Written 555 autogen files
19:46    SceneryProcessor    Information    scenProc finished processing
19:46    SceneryProcessor    Information      30,05 seconds for IMPORTOGR
19:46    SceneryProcessor    Information      56,80 seconds for SPLITGRID
19:46    SceneryProcessor    Information       0,03 seconds for SETAGNBUILDINGHEIGHT
19:46    SceneryProcessor    Information       3,58 seconds for PLACEPOINTSALONGLINE
19:46    SceneryProcessor    Information       1,05 seconds for REPLACEPOLYGONBYVEGETATIONRECTANGLES
19:46    SceneryProcessor    Information       0,05 seconds for CREATEAGNLIBOBJ
19:46    SceneryProcessor    Information      55,68 seconds for CREATEAGNGENBUILD
19:46    SceneryProcessor    Information       0,36 seconds for CREATEAGNRECTVEG
19:46    SceneryProcessor    Information       1,45 seconds for EXPORTAGN
19:46    SceneryProcessor    Information     149,04 seconds total

And that's the result:
no vegetation, the buildings have been placed correctly, but there are also a few parts (red circles) where no autogen buildings got placed...
zwischenablage01w3ab5.jpg
 
Two suggestions

1) Try using a smaller value for the area , replace 0.001->0.0001 .
2) Delete the lines

ReplacePolygonByVegetationRectangles|FTYPE=POLYGON; FROMFILE=Merged.shp; code=7201|0.001|0.25|0.25
ReplacePolygonByVegetationRectangles|FTYPE=POLYGON; FROMFILE=Merged.shp; code=7202|0.001|0.4|0.25
if you dont intent to use legacy 2004 autogen and go directly


CREATEAGNPOLYVEG|code=7201|{D3A99E0B-AB45-42BD-A031-AE36248199A0}
CREATEAGNPOLYVEG|code=7202|{8EF6A032-8AA8-48F0-80EA-90A16B3696DD}

using different GUIDs.

PS. I dont know which version you use , but the syntax for the latest release is code="7201" .
 
Hi,

Can you maybe show a screenshot of the attributes of your vector data as well. Even in the last script nothing get's selected with the filter.
 
I am using Scenproc v.1.1.0.0

Here is a screenshot out of ArcMap:
zwischenablage01zokem.jpg


Deleting the ReplacePolygonByVegetationRectangles-Lines helped, but now the rectangles are too big like you can see in the picture below:
zwischenablage0124sf4.jpg


By the way, the problem with the buildings is now solved too
 
Hi,

That indicates the filter is right. So then I think you should try to use a smaller rectangle size in your script. The 0.001 degrees you have now it quite big.
 
I tried it yesterday with 0.00001, but again no vegetation rectangles have been created...

I think the problem has to do with the Lines ReplacePolygonByVegetationRectangles... when I add these lines to my script, no vegetation gets created....

I just want to use Autogen Rectangles because I want to try to get a higher Autogen Vegetation density in P3D
 
Last edited:
I splitted the merge.shp now into two parts, buildings and landuse to avoid the filters inside the ReplacePolygonByVegetationRectangles and set the size to 0.000000001... I think that is definitly fine enough...

That's my script now:
Code:
#ImportOGR|C:\Users\mknue\Desktop\DUS\OSM\Buildings.shp|*|*|AUTODETECT
ImportOGR|C:\Users\mknue\Desktop\DUS\OSM\Landuse.shp|*|*|AUTODETECT
ImportOGR|C:\Users\mknue\Desktop\DUS\OSM\Roads.shp|*|*|AUTODETECT
#
SplitGrid|AGN|*
SetAGNBuildingHeight|*|1.0;0.0;0.0;0.0
#
PlacePointsAlongLine|FTYPE=LINE;FROMFILE=Roads.shp|SINGLE|120;120|7;7|0|OBJECT|LIGHT|HDG
#
ReplacePolygonByVegetationRectangles|FROMFILE=Landuse.shp|0.000000001|0.5|0.3
CreateAGNLibObj|OBJECT=LIGHT|{1f414356-7436-4b12-95c7-ae2d49a2c226}|HDG|0|16;16
#
#CreateAGNGenBuild|FROMFILE=Buildings.shp;FWIDTH<20|{5ae04eb6-934c-4f63-bb48-5e7dee601212}
#CreateAGNGenBuild|FROMFILE=Buildings.shp;FWIDTH>20|{4EB68BE7-2F1F-4cd2-920E-BECFA2D8C888}
#
CreateAGNRectVeg|code=7201|{8EF6A032-8AA8-48F0-80EA-90A16B3696DD}
CreateAGNRectVeg|code=7202|{D3A99E0B-AB45-42BD-A031-AE36248199A0}
CreateAGNRectVeg|code=7210|{D3A99E0B-AB45-42BD-A031-AE36248199A0}
CreateAGNRectVeg|code=7217|{D3A99E0B-AB45-42BD-A031-AE36248199A0}
#
ExportAGN|P3D v2|C:\Users\mknue\Desktop\DUS\Autogen

Code:
07:50    ImportOGR    Information    Reading file C:\Users\mknue\Desktop\DUS\OSM\Landuse.shp
07:50    ImportOGR    Information    Initializing input projection to +proj=longlat +datum=WGS84 +no_defs
07:50    ImportOGR    Information    Initializing input projection to +proj=longlat +datum=WGS84 +no_defs
07:50    ImportOGR    Information    Read 4707 features from file
07:50    ImportOGR    Information    Reading file C:\Users\mknue\Desktop\DUS\OSM\Roads.shp
07:50    ImportOGR    Information    Initializing input projection to +proj=longlat +datum=WGS84 +no_defs
07:50    ImportOGR    Information    Initializing input projection to +proj=longlat +datum=WGS84 +no_defs
07:50    ImportOGR    Information    Read 2699 features from file
07:50    SplitGrid    Information    Splitting features in 0,0146484375 x 0,010986328125 grid...
07:50    SplitGrid    Information    Features divided in 814 cells
07:50    SetAGNBuildingHeight    Information    Setting autogen building heigth...
07:50    SetAGNBuildingHeight    Information    Set autogen building heigth for 763 cells
07:50    PlacePointsAlongLine    Information    Placing point features along lines with filter FTYPE=LINE;FROMFILE=Roads.shp...
07:50    PlacePointsAlongLine    Information    Created 4830 point features
07:50    ReplacePolygonByVegetationRectangles    Information    Replacing polygons with vegetation rectangles for polygons that match filter FROMFILE=Landuse.shp
07:50    ReplacePolygonByVegetationRectangles    Information    Created 0 vegetation rectangles
07:50    CreateAGNLibObj    Information    Creating autogen library objects with filter OBJECT=LIGHT...
07:50    CreateAGNLibObj    Information    Created 4802 autogen objects
07:50    CreateAGNRectVeg    Information    Creating autogen rectangular vegetation with filter code=7201...
07:50    CreateAGNRectVeg    Information    Created 0 autogen objects
07:50    CreateAGNRectVeg    Information    Creating autogen rectangular vegetation with filter code=7202...
07:50    CreateAGNRectVeg    Information    Created 0 autogen objects
07:50    CreateAGNRectVeg    Information    Creating autogen rectangular vegetation with filter code=7210...
07:50    CreateAGNRectVeg    Information    Created 0 autogen objects
07:50    CreateAGNRectVeg    Information    Creating autogen rectangular vegetation with filter code=7217...
07:50    CreateAGNRectVeg    Information    Created 0 autogen objects
07:50    ExportAGN    Information    Writing AGN files to folder C:\Users\mknue\Desktop\DUS\Autogen
07:51    ExportAGN    Information    Created 4830 library objects
07:51    ExportAGN    Information    Written 229 autogen files
07:51    SceneryProcessor    Information    scenProc finished processing
07:51    SceneryProcessor    Information       1,55 seconds for IMPORTOGR
07:51    SceneryProcessor    Information       1,91 seconds for SPLITGRID
07:51    SceneryProcessor    Information       0,02 seconds for SETAGNBUILDINGHEIGHT
07:51    SceneryProcessor    Information       0,05 seconds for PLACEPOINTSALONGLINE
07:51    SceneryProcessor    Information       0,09 seconds for REPLACEPOLYGONBYVEGETATIONRECTANGLES
07:51    SceneryProcessor    Information       0,06 seconds for CREATEAGNLIBOBJ
07:51    SceneryProcessor    Information       0,08 seconds for CREATEAGNRECTVEG
07:51    SceneryProcessor    Information       0,30 seconds for EXPORTAGN
07:51    SceneryProcessor    Information       4,06 seconds total

Again no rectangles got created

EDIT:
I tried it also with ScenProc v2, but there I have the same problem, no autogen vegetation rectangles got created.
 
Last edited:
Hi,

It must be something in the SHP I guess. Could you send me the file so that I can have look. This size must be small enough for sure.

Another option that I use myself often is to place points in the polygons and use these points to create rectangular vegetation. That also gives good control over the density.
 
I had a quick look at the file, but the attributes look OK. I have to run it in scenProc to see what is going on, I'll do that later.
 
Hi,

I have just tested with this script in the latest development release and it creates vegetation rectangles. Maybe you can try if this script also works on your side?

Code:
ImportOGR|Landuse.shp|*|*|AUTODETECT
#
SplitGrid|AGN|*
#
ReplacePolygonByVegetationRectangles|FROMFILE=Landuse.shp|0.001|0.5|0.3
#
CreateAGNRectVeg|code=7201|{8EF6A032-8AA8-48F0-80EA-90A16B3696DD}
CreateAGNRectVeg|code=7202|{D3A99E0B-AB45-42BD-A031-AE36248199A0}
CreateAGNRectVeg|code=7210|{D3A99E0B-AB45-42BD-A031-AE36248199A0}
CreateAGNRectVeg|code=7217|{D3A99E0B-AB45-42BD-A031-AE36248199A0}
 
Now, using the latest development release of ScenProc it is working for me too!

Thank you so much for your help!
 
Glad to hear that. Probably a bug in version 1.1 that I have fixed (but couldn't remember).
 
Back
Top