Question

Intersect Vector Data with Raster

  • 27 January 2023
  • 3 replies
  • 32 views

Badge +1

Hello, I have a raster dataset. I need to intersect vector lines with it and then get the average values of the raster cells (pixels) that intersect with the vector line. I have a working solution to do this but I have to convert the raster to polygons with a RasterToPolygonCoercer. Some rasters are larger (8.2M cells) so this takes forever and is very memory intensive. Is there a better way to do this without converting raster to vector polygons?

 

I'm not super experienced with rasters so please explain well.

 

Thanks in advance!

 

 


3 replies

Badge +2

@justincornell​ Try SurfaceDraper. It will accept a DEM in the Points/Lines port and then you can drape your line and perhaps average the Z values

Badge +1

@justincornell​ Try SurfaceDraper. It will accept a DEM in the Points/Lines port and then you can drape your line and perhaps average the Z values

@Mark Stoakes​ thanks for the direction. This sort of works, the z calcs at the edges of the raster are being misrepresented because of values that are 3.4e+38 and it's using those values to include in the model. Those are not being recognized at NODATA values. I have tried using the RasterBandValueReplacer (value > 100000 set to 999999999) followed by a RasterBandNoDataSetter (999999999 set as no data values and replace cells set to yes). Nevertheless, I still get Z values that are outside the of the 2 cells in the raster (.405554 and .405366) that intersect my vector polygon. I get Z values between .11324 and .40988 for the vertexes of the polygon. The original way by converting to vector polygons gave me 0.40545503 but this new surface draper way give me 0.27242. This is quite a bit difference and I don't know why.

 

I tried to clip the raster to the vector polygon after the RasterBandValueReplacer and the RasterBandNoDataSetter and then using the clipper outpt as input for the SurfaceDraper but I get the error. "Surface Model cannot be constructed. Either all points are linear or initial set of points did not consist of 3 non NAN elevations" See attached image of the workflow

 

Thoughts on things to try?

Badge +1

@justincornell​ Try SurfaceDraper. It will accept a DEM in the Points/Lines port and then you can drape your line and perhaps average the Z values

Here is the raster. It would not allow me to be upload 2 at a time.

Reply