Polyline To Raster support for Z values

770
7
11-09-2023 02:51 PM
Status: Open
Labels (1)
curtvprice
MVP Esteemed Contributor

The Polyline To Raster tool does not support Z values. Would like an option to rasterize on Z values (linearly interpolated along a line)  instead of an attribute.

This would be very helpful when integrating polyline data with Z values into raster elevation surfaces. For example - comparing Z enabled lines to an elevation surface, or calculating cell by cell differences between Z enabled polylines and a raster.

gdal_rasterize supports this (-3d option) but the Z interpolation along the feature between vertices has been giving us problems (not accurate).

7 Comments
JosephTaubert_TKDA

@curtvprice Any luck with this? I am in the same boat.

Ken_Rukstales

You could try the following:

  1. Use the Poly to Raster tool to rasterize the polyline.
  2. Convert those rasterized cells to points using the Raster to Point tool.
  3. Use the Near 3D tool to get the z-value for each point.
  4. Convert those points back to a raster using the Point to Raster tool.
Ken_Rukstales

A follow-up to my post above.

In step 3, the Near 3D tool returns the nearest three-dimensional distance to the polyline, as well as the z-value at that point.  In this case, since the points obtained in steps 1 and 2 are points that define the polyline, the nearest distance will essentially be the perpendicular distance to the polyline.  If you want the z-value that is vertically below (or above) the rasterized point, you will need to use the geometric attributes returned by the Near 3D tool to get that z-value.

lsturtevant

While attempting to do the same workflow with PolylineZM features, I discovered a similar BUG or deficiency with the Feature To Raster tool which allows for the Shape.Z to be used as the input field but does not actually work. This BUG is documented here: BUG-000158717 for ArcGIS Pro (esri.com)

The workaround that @Ken_Rukstales provided looks solid and I will definitely look into that. The intent of my workflow was to create a rasterized stream network from a PolylineZM at the same resolution of a raster DEM. The workaround that I came up with uses the densify tool to ensure the PolylineZM feature has the same resolution as the target raster. This densify tool does a good job with linearly interpolating Z values along the lines where it inserts new vertices which is why I use it for the stream network processing, but this could be an optional processing step depending on your workflow. The vertices can then be converted to points, the Z values calculated as an attribute field, and finally rasterized using a target raster as the output snap grid and cell size environment.

  1. Densify (Editing)—ArcGIS Pro | Documentation (Optional)
  2. Feature Vertices To Points (Data Management)—ArcGIS Pro | Documentation
  3. Calculate Geometry Attributes (Data Management)—ArcGIS Pro | Documentation
  4. Point to Raster (Conversion)—ArcMap | Documentation (arcgis.com)
curtvprice

Thanks for the excellent thoughts, fine sirs!

For the record I have an incident logged:

Esri Case #03484588 - Conversion of Z enabled Polyline to Raster

curtvprice

Hi Ken - your method worked pretty darn fast and did the interpolation without the step of densifying the lines or doing the processing of creating points for every vertex.

A little detail: to run the Near 3D the input must have Z values so when I ran Raster To Point I had to enable Zs and assign a default value using the environment settings for the tool run.

curtvprice

This has been logged!

ENH-000163033: Provide the capability to support Z values in the Polyline to Raster tool in ArcGIS Pro