2

I have a polygon (pond) and I need to ensure it is at one elevation. I have converted all vertices of the polygon to points, used summary statistics to determine the range in elevations and if the range is greater than 0, it indicates there is a discrepancy in elevation values. I do not have spatial analyst or 3D analyst. Is there an easier way or code to do this in ArcGIS? I received this layer from a fellow employee that extracted the data from a LiDAR point cloud using MicroStation. Therefore, I do not have the original elevation (raster) layer, just a shapefile that has elevation values attached to the vertices. I am looking for a way to identify a polygon whose vertices have different elevation values. Each polygon should have one elevation value associated with each vertice. For example, Polygon A should have a 120m elevation value for each vertice in the polygon. I am looking for something to check if the vertices are different.

4

This works without SA or 3D

import arcpy, traceback, sys
##, numpy
from arcpy import env
env.overwriteOutput = True

pntFile=arcpy.GetParameterAsText(0)
rasters=arcpy.GetParameterAsText(1)
rasters=rasters.split(';')
theFields=arcpy.ListFields(pntFile)
theFields=[x.name.lower() for x in theFields]
result=arcpy.GetCount_management(pntFile)
nF=int(result.getOutput(0))
p=arcpy.Point()
try:
    def showPyMessage():
        arcpy.AddMessage(str(time.ctime()) + " - " + message)
    arcpy.AddMessage('\n')
    for raster in rasters:
                desc=arcpy.Describe(raster)
                theFLD=raster.lower()
                arcpy.AddMessage("Sampling "+theFLD)
                if not(theFLD in theFields):
                        arcpy.AddField_management(pntFile, theFLD, "FLOAT")
                arcpy.SetProgressor("step", "", 0, nF)
                with arcpy.da.UpdateCursor(pntFile,("SHAPE@XY",theFLD)) as rows:
                        for row in rows:
                                XY=row[0]
                                p.X,p.Y=XY
                                myArray = arcpy.RasterToNumPyArray(raster,p,1,1,-9999)
                                row[1]=myArray[0,0]
                                rows.updateRow(row)
                                arcpy.SetProgressorPosition()
                        del row,rows
    arcpy.AddMessage('\n')
except NameError, theMessage:
    arcpy.AddMessage (theMessage)
except:
    message = "\n*** PYTHON ERRORS *** "; showPyMessage()
    message = "Python Traceback Info: " + traceback.format_tb(sys.exc_info()[2])[0]; showPyMessage()
    message = "Python Error Info: " +  str(sys.exc_type)+ ": " + str(sys.exc_value) + "\n"; showPyMessage()

Script works from mxd. Parameters are point layer (shapefile) and list of rasters:

Script Tool Interface

  • forgot to mention. Make raster layer(s) name short, e.g. Lidar, because script creates same name field in point layer table and populates it with raster values. – FelixIP Nov 10 '14 at 22:15
  • Thank you for your comment. I received this layer from a fellow employee that extracted the data from a LiDAR point cloud using MicroStation. Therefore, I do not have the original elevation (raster) layer, just a shapefile that has elevation values attached to the vertices. I am looking for a way to identify a polygon whose vertices have different elevation values. Each polygon should have one elevation value associated with each vertice. For example, Polygon A should have a 120m elevation value for each vertice in the polygon. I am looking for something to check if the vertices are different. – Ashleigh Nov 15 '14 at 16:26
  • Use feature to point if you have advanced license. This should produce pointZ with polygon ID. You can summarise polygon ID to find StDev for Z and check if it is close to zero – FelixIP Nov 17 '14 at 2:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.