How to 'Interpolate' features to a surface without creating a seperate file?

2681
7
07-26-2016 01:16 PM
ChrisStephens1
New Contributor

Is there way to do what the 'Interpolate Shape' tool does but calculates the z values into the Shape field of the input feature instead of making a new output? As far as I can tell the only other way is by using the 3D Analyst toolbar and selecting the 'Interpolate' tool based on the geometry I need but I'd rather not have to click that every time I digitize something but would prefer to do it after all my features at once after they're created. 'Interpolate Shape' does that but makes a separate file, which does not fit into my workflow. Is there another way? Perhaps using the Field Calculator?

0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus

None exist.  You could experiment witth scriptting the process, generating the output in memory, deleting the original (if possible) and replacing it.  Whether this could be done in one step... I am not sure.

Interpolate Shape—Help | ArcGIS for Desktop

XanderBakker
Esri Esteemed Contributor

Indeed as Dan states, it is most unlikely that you can if the featureclass has not yet the Z values enabled.

Suppose you have a Polyline featureclass (Shapefield will contain "Polyline" not "Polyline Z"). When you create the featureclass, you specify if Z (and M) values are enabled. If Z is not enabled, you can set the Z values of the vertices, but they will not be stored. If the featureclass has Z values enabled on creation but you do not set them initially, you can update the Z values without creating a new output (although this would require some scripting).

ChrisStephens1
New Contributor

> it is most unlikely that you can if the featureclass has not yet the Z values enabled.

Z Values are enabled for my feature classes! Shape field has a value of 'Polyline Z'.

>If the featureclass has Z values enabled on creation but you do not set them initially, you can update the Z values without creating a new output (although this would require some scripting).

This is what I need to do. Is there any more information on this method?

0 Kudos
XanderBakker
Esri Esteemed Contributor

OK, you have polylines with Z enabled, yet Z has no value assigned yet.

What I would do in this case is create a tmp point featureclass with the vertices of the polygons and information on original OID of the polyline, part number and point number (to be able to link the vertice after Z has been defined back to same vertice in the polyline). Next, assuming you have spatial analyst available, is use the tool extract values to points to extract the Z value for each point into a new tmp featureclass (you could do this using the IN_MEM workspace, but it depends on the amount of points, if this will work in memory).

The next step would be to create a search cursor and fill a dictionary from the points with the Z values as attribute (use OriginalOID_PartNumber_PointNumber as key and the Z as value) and use this when you create the update cursor to update the Z value if the individual vertices.

You can find detailed information on working with 3D geometries in arcpy in my blog post here: Working with 3D and M-aware geometries in Arcpy

0 Kudos
ChrisStephens1
New Contributor

Thank you for the reply. That sounds like it would work, but again I just want the z values calculated in the existing dataset, no temp files or output files. I guess it's impossible, save for using the 3D Analyst Toolbar 'Interpolate' for every feature I create. I'm trying to streamline a very large data collection workflow.

0 Kudos
XanderBakker
Esri Esteemed Contributor

There are always solutions... See an alternative method pointed out in this document: Extract Raster Values using Numpy

ChrisStephens1
New Contributor

That's disappointing! Thanks for the reply

0 Kudos