Skip to main content

I am trying to find the elevation of the most prominent "peaks" in an area, but am stuck.

 

 

I have used a number of polygons to Clip a selection of mountains. These are in a raster DEM format. Now I want to find the highest point on each mountain, along with it's position. This will later be saved as a point feature.

 

 

Using the RasterCellCoercer results in an insane amount of data. I have tried to filter out the highest values before I proceed, but have not yet figured out how to do so.

 

 

The RasterBandMinMaxExtractor with a ListExploder gives me the highest value for each raster area, but I also need the position of this pixel.

 

 

Any suggestions on how to proceed? How can I get both the highest value, and it's location , without turning my computer into a toaster?

This should be much quicker than coercing into points or polygons:

The point geometry on the right side will be a 3D point giving the location of the maximum Z value. The Z value itself is also available in the attribute z.max.

Just be aware that you may have several points output for the same raster if there are several raster cells with the identical, maximum value. In that case you could use a Sampler (first 1) with a group by on the raster name.


This should be much quicker than coercing into points or polygons:

The point geometry on the right side will be a 3D point giving the location of the maximum Z value. The Z value itself is also available in the attribute z.max.

Just be aware that you may have several points output for the same raster if there are several raster cells with the identical, maximum value. In that case you could use a Sampler (first 1) with a group by on the raster name.

Ha the good old raster to pointcloud trick, I keep forgetting that! nice one @david_r


Ha the good old raster to pointcloud trick, I keep forgetting that! nice one @david_r

Probably the first time I've used it, so let's hope it works! :-)


Probably the first time I've used it, so let's hope it works! :-)

Tested it and it does!


Another option is to use a RasterStatisticsCalculator to calculate the Max, an expression evaluator to set a dummy value to every pixel that doesn't match the max, then use this to set as no data and use the raster to polygon to converter whilst ignoring no data values


Another option is to use a RasterStatisticsCalculator to calculate the Max, an expression evaluator to set a dummy value to every pixel that doesn't match the max, then use this to set as no data and use the raster to polygon to converter whilst ignoring no data values

Very creative! I'd love to see how it compares with the point cloud solution, performance wise.


Very creative! I'd love to see how it compares with the point cloud solution, performance wise.

2.9 secs (raster solution) v 3.2(point cloud solution) for my very limited sample


Thanks @david_r and @egomm for promising solutions! Have a nice weekend!


There is an existing enhancement request to return position along with z max in the RasterBandMinMaxExtractor. I'll add a note that there is a useful case here too. For your interest, the reference number is FMEENGINE-36899, in case you need to get in touch with us about it.


This should be much quicker than coercing into points or polygons:

The point geometry on the right side will be a 3D point giving the location of the maximum Z value. The Z value itself is also available in the attribute z.max.

Just be aware that you may have several points output for the same raster if there are several raster cells with the identical, maximum value. In that case you could use a Sampler (first 1) with a group by on the raster name.

Thanks! This worked perfect. And it was quick to!


Very creative! I'd love to see how it compares with the point cloud solution, performance wise.

A smallish raster:

Provides different results:

My guess is that the PC handling in FME, is still superior to raster. (using FME 2018.1.1.2)


There is an existing enhancement request to return position along with z max in the RasterBandMinMaxExtractor. I'll add a note that there is a useful case here too. For your interest, the reference number is FMEENGINE-36899, in case you need to get in touch with us about it.

In my test example, the RasterBandMinMaxExtractor returns a string which then can't be used in the RasterExpressionEvaluator. I wouldn't expect a max to be returned as a string?


In my test example, the RasterBandMinMaxExtractor returns a string which then can't be used in the RasterExpressionEvaluator. I wouldn't expect a max to be returned as a string?

Yes, it does appear to be a string attribute. But that doesn't and shouldn't stop it working in the RasterExpressionEvaluator (or any arithmetic editor). At least it seems to work for me. I can use @Value(A:_band{0}.min)+5 as the expression without problem. Does it cause an error or rejected feature for you?


Yes, it does appear to be a string attribute. But that doesn't and shouldn't stop it working in the RasterExpressionEvaluator (or any arithmetic editor). At least it seems to work for me. I can use @Value(A:_band{0}.min)+5 as the expression without problem. Does it cause an error or rejected feature for you?

It doesn't cause an error as such, i think it's down to the way the number is stored.

Using the following expression

if (As0]>=@Value(A:max),@Value(A:max),-9999)

If the max value comes from the RasterStatisticsCalculator - in my case this is a Real32 value - a single pixel retains it's value and every other pixel is set to -9999.

If the max value comes from the RasterBandMinMaxExtractor as a string, the first condition is not met and every pixel is set to -9999


Reply