Skip to main content

I have a single band raster (DEM raster) I want to create polygons which represent ranges.

For example I have pixels with a range from 100 - 500 and I want to create polygons where values are in the range 100-105, or 105-110.

 

I've tried to contourGenerator and building areas from those but contours aren't close so it's not really an option.

 

RasterToPolygonCoercer I think would work but I need to first get my raster values to be grouped by the interval - this is where I'm having trouble. any ideas?

I think it will be easier to work with the polygons after the RasterToPolygonCoercer. You can use the AttributeRangeMapper to create your range groups, and then a Dissolver based on the _looked_up attribute.


You can use the RasterCellValueReplacer to replace all cell values within a specified range, but on the downside you can only do one range per transformer instance. So if you have a lot of ranges, it could get a bit messy.

If the ranges are all identically spaced, e.g. every 10 meter, you could use the RasterCellValueRounder using negative rounding, there's an example in the help for this transformer.


Thanks guys, in the end I figured out a way just with the RasterExpressoinEvaluator.

Using the following expression I was able to bin up the raster into equal ranges:

@ceil((A[0]-@Value(A:_band{0}.min))/$(CONTOUR_INTERVAL))

Then use the RasterToPolygonCoercer to get the polygons. Once I have the polygons I could just use the min value and the bin number to calculate the range in each polygon.

It was pretty basic math in the end. I think the RasterCellValueRounder would also probably be what I wanted but my range is just 0.5 it makes the math a little harder haha

 


You can use the RasterCellValueReplacer to replace all cell values within a specified range, but on the downside you can only do one range per transformer instance. So if you have a lot of ranges, it could get a bit messy.

If the ranges are all identically spaced, e.g. every 10 meter, you could use the RasterCellValueRounder using negative rounding, there's an example in the help for this transformer.

@david_r​ @virtualcitymatt​ FYI: RasterCellValueReplacer  has been upgraded to a table so you can enter multiple ranges:

image


Reply