Skip to main content
Solved

Find position and value of highest elevation on a DEM raster?

  • September 6, 2019
  • 14 replies
  • 749 views

aron
Enthusiast
Forum|alt.badge.img+16
  • Enthusiast
  • 136 replies

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?

Best answer by david_r

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 post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

14 replies

david_r
Celebrity
  • 8392 replies
  • Best Answer
  • September 6, 2019

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.


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • 1442 replies
  • September 6, 2019

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


david_r
Celebrity
  • 8392 replies
  • September 6, 2019

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! :-)


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • 1442 replies
  • September 6, 2019

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

Tested it and it does!


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • September 6, 2019

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


david_r
Celebrity
  • 8392 replies
  • September 6, 2019

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.


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • September 6, 2019

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


aron
Enthusiast
Forum|alt.badge.img+16
  • Author
  • Enthusiast
  • 136 replies
  • September 6, 2019

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


mark2atsafe
Safer
Forum|alt.badge.img+56
  • Safer
  • 2554 replies
  • September 6, 2019

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.


aron
Enthusiast
Forum|alt.badge.img+16
  • Author
  • Enthusiast
  • 136 replies
  • September 9, 2019

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!


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • 1442 replies
  • September 9, 2019

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)


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • September 10, 2019

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?


mark2atsafe
Safer
Forum|alt.badge.img+56
  • Safer
  • 2554 replies
  • September 10, 2019

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?


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • September 11, 2019

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 (A[0]>=@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