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

P3D v5 Water Detection idea (work-around)

Ah, good eye. I corrected but still get the following error at the detection step:

11:07 AM SceneryProcessor Error System.IO.InvalidDataException: Unexpected image type Emgu.CV.Image`2[Emgu.CV.Structure.Gray,System.Byte]
at ASToFra.scenProc.Steps.DetectFeatures.Process(List`1 cells, String[] arguments)
at ASToFra.scenProc.Processor.SceneryProcessor.Process()
at ASToFra.scenProc.Processor.SceneryProcessor.ProcessConfig(String filename, List`1 commands)

For Method 1, here is a screenshot:

74 BS32 slope method 2 - CEN_0-1_FAREA-200.jpg


The following steps were used for the above results:
ImportGDAL|B:\CA\Section_74\Images\CA_BS32_DEM.tif|*|NOREPROJ|String;CENTER|elev
ImportGDAL|B:\CA\Section_74\Images\CA_BS32.tif|*|NOREPROJ|String;type|image

ProcessElevationRaster|type="elev"|SLOPE|String;type|slope

SplitGrid|LOD13|*

DetectFeatures|type="image"|B:\CA\Section_74\_Control Data\CA_Section_74_TFE_Water.tf2|String;WatType|water|NONE

AddAttributeSampleRaster|type="water"|type="slope"|CENTER|slope

# Unload all features where the slope is above a certain threshold
UnloadFeatures|slope_0>1

MergeGrid

ExportOGR|WatType="water"AND FAREA>200|ESRI Shapefile|B:\CA\Section_74\Masks Water Tests\CA_BS32_WM_CENT_1_200.shp|water

It almost appears at the Unload step, anything greater than 1% is retained, not removed... the opposite? As you can see those slopes are way greater than 1%.
 
Last edited:
In the step where you add the slope attribute you are using type="water", while elsewhere you use Wat type="water". So I don't think a slope attribute is added and therefore nothing is unloaded as well.

In the event log you should see messages how many features were processed by the step.
 
Ok, made the correction. Still no change. Here is the script and a screenie of the processing where no features were removed.

ImportGDAL|B:\CA\Section_74\Images\CA_BS32_DEM.tif|*|NOREPROJ|String;CENTER|elev
ImportGDAL|B:\CA\Section_74\Images\CA_BS32.tif|*|NOREPROJ|String;type|image

ProcessElevationRaster|type="elev"|SLOPE|String;type|slope

SplitGrid|LOD13|*

DetectFeatures|type="image"|B:\CA\Section_74\_Control Data\CA_Section_74_TFE_Water.tf2|String;type|water|NONE

AddAttributeSampleRaster|type="water"|type="slope"|CENTER|slope

UnloadFeatures|slope_0>1

MergeGrid

ExportOGR|type="water"|ESRI Shapefile|B:\CA\Section_74\Masks Water Tests\CA_BS32_WM_CENT_1.shp|water

74 BS32 slope method 2 - CEN_0-1 processing steps.jpg
 
You assign your elevation raster an attribute CENTER="elev", but when calculating the slope you select type="elev". So that means nothing matches and no slope is calculated.
 
Hi,

Could the procedure be adapted for mountain roads in FS2020? Like lakes and rivers, we often see them following the slope when in reality they are transversely flat.

I had suggested this simple routine to Asobo: every x meters (depending on the desired degree of precision), transversely, place the highest side of the road at the same level as the lowest side. Without answer...
 
I'm not sure how scenproc could help with roads in MSFS, since scenproc can not make them.

To be able to fix roads you would need very high resolution elevation data as well, which is not always available. It would be easier to have some procedural rules that roads are flat and modify the elevation data based on that.
 
Back from another trip, I was able to make the adjustments and I am beginning to see promising results as a work-around. Lot's of testing in different geographic areas are still needed but this could save a lot a of "clean-up" time where the current water detection misses. I'll show you results when I continue testing. :)
 
Starting to test with your 2nd method. I am confused with this step:

DetectFeatures|type="slope"|slope_threshold.tfc|String;type|mask|NONE

Am I to create a 2nd .tfc file (which you named above 'slope_threshold.tfc' as an example), for this method to process? If so, how does one create this tfc file? I take it using the TFE but is there a step to create this? Does one create a TFE script and use the Threshold Binary step? How would the TFE script look like?
 
You just make a texture filter like normal, but then to work on the slope image instead of images. So it just needs a binary threshold step with the threshold slope value you want.
 
I may need a little "hand-holding" as I go through method #2. To create the 2nd texture filter (.tf2), I will have to break down my DEM image into sample size images like I do with my regular images? Or can I just use the DEM image itself since the size is so small? Yea, way lost here. So if I open the Threshold Binary step in TFE I default threshold of 128, which would understand this is half way on the grayscale of the DEM image? How does the relate to slop when that represents altitude?
 
Last edited:
Hi,

I would just try it at the current size first. You are not using the DEM image directly of course in the texture filter, you are using the slope image that was generated from it. By using the 2nd texture filter you can select the areas with low slope and use these for masking in the water detection.
 
Back at testing the slope methods, in particular method 2. In TFE I created my script and add the step Theshold Binary (made no changes to the values).

Slope Detection Meth2 script.jpg

Hers is my script:

ImportGDAL|B:\CA\Section_179\Images\CA_Q18_DEM.tif|*|NOREPROJ|String;type|elev
ImportGDAL|B:\CA\Section_179\Images\CA_Q18.tif|*|NOREPROJ|String;type|imagey

ProcessElevationRaster|type="elev"|SLOPE|String;type|slope|1;0
DetectFeatures|type="slope"|B:\CA\Section_179\_Control Data\CA_Section_179_TFE_Water-Meth2.tf2|String;type|water|NONE
DetectFeatures|type="imagery"|B:\CA\Section_179\_Control Data\CA_Section_179_TFE_Water-Meth2.tf2|String;type|water|type="mask"

MergeGrid
ExportOGR|type="water"|ESRI Shapefile|B:\CA\Section_179\Masks Water\CA_Q18_WM-meth2.shp|water

Here is processing result with error:
Slope Detection Meth2 script - error.jpg


Am I on the right path for understanding the method?

Question, in the step ProcessElevationRastar the is 'slope|1;0' at the end. Does this mean I am filter out slopes greater than 1 meter so 2;0 would be 2 meters, etc?
 
Hi,

You are using the same TFC file for both DetectFeature steps. That is not right. The first one should only process the slope raster and that TFC file should basically only have a binary threshold step with the slope value that you want to use as threshold for the mask. It should have no other steps.
 
Ok, I thought when I first read up on your method 2 one needed to create two .tf2 files, but wasn't sure. I will try the script using two different .tf2 files. Do you think off hand that one method is better than the other?
 
I think using the mask might be slightly more efficient, as else you have a lot of features that need to sample the raster. But I'm not sure, I never compared them in detail.
 
I'm still not doing it right. Current script:

ImportGDAL|B:\CA\Section_179\Images\CA_Q18_DEM.tif|*|NOREPROJ|String;type|elev
ImportGDAL|B:\CA\Section_179\Images\CA_Q18.tif|*|NOREPROJ|String;type|imagey

ProcessElevationRaster|type="elev"|SLOPE|String;type|slope|1;0

DetectFeatures|type="slope"|B:\CA\Section_179\_Control Data\CA_Section_179_TFE_Water-Meth2-SlopeThres.tf2|String;type|mask|NONE

DetectFeatures|type="imagery"|B:\CA\Section_179\_Control Data\CA_Section_179_TFE_Water-Meth2.tf2|String;type|water|type="mask"

ExportOGR|type="water"|ESRI Shapefile|B:\CA\Section_179\Masks Water\CA_Q18_WM-meth2.shp|water

I get no output with the following error:
11:54 AM DetectFeatures Warning Unsupported image type Emgu.CV.Image`2[Emgu.CV.Structure.Gray,System.Byte], skipping

My steps for the Slope Threshold (SlopeThres.tf2), is:


Slope Detection Meth2 script for DEM image.jpg
 
Hi,

Is it the first or the second detect features step that gives this error.

What data type is your dem raster?
 
Let me try to reproduce, it seems the slope map is not of a supported type.
 
Back
Top