arcpy.CheckOutExtension("3D") env.workspace = "C:/data" arcpy.RasterDomain_3d("dtm_grd", "raster_domain.shp", "POLYGON")
Solved! Go to Solution.
#disable M and Z values in output arcpy.env.outputZflag = "Disabled" arcpy.env.outputMflag = "Disabled"
#Script to loop through rasters in an mxd, and print a shape file of their extent (exact boundary, not rectangle). import arcpy from arcpy import env #disable M and Z values in output arcpy.env.outputZflag = "Disabled" arcpy.env.outputMflag = "Disabled" arcpy.CheckOutExtension("3D") mxd = arcpy.mapping.MapDocument(<insert path to mxd here>) env.workspace = <insert path to workspace here>(mxd, "_*") for raster in rasters: #Generate a unique name for each polygon/ shapefile. Have given them the prefix "del" so I can find them and delete them later outPoly = "del" + str(raster) + ".shp" #Execute Raster Domain Tool arcpy.RasterDomain_3d(raster, outPoly, "POLYGON") #get the feature classes from this folder fcList = arcpy.ListFeatureClasses() for fc in fcList: #Generate a unique name for each simplified polygon simpPoly = fc.lstrip("del_")+ "simp_" + fc.rstrip(".shp") #Execute Simplify Polygon tool arcpy.SimplifyPolygon_cartography(fc, simpPoly, "POINT_REMOVE", 1, "", "", "NO_KEEP") #get feature classes for deletion from same folder deleteBigPolys = arcpy.ListFeatureClasses("del*") #delete these features classes (too large) for deleteBigPoly in deleteBigPolys: arcpy.Delete_management(deleteBigPoly)