AnsweredAssumed Answered

Modify a Python script to one that uses RasterDomain_3d fuctionality - and writes resulting shapefiles it to one

Question asked by GIS_103500 on Jan 15, 2015

I posted this on StackExchange already but do not get any feedback there...  so here I go again:

 

As I am not very experienced with Python I need your help. I managed to modify a Script (that has been posted here Get boundary of raster image as polygon in ArcGIS Desktop? by http://gis.stackexchange.com/users/2043/jeb)

 

import arcpy,os

 

InFolder = arcpy.GetParameterAsText(0)

Dest=arcpy.GetParameterAsText(1)

 

arcpy.env.workspace=InFolder

#The raster datasets in the input workspace

in_raster_datasets = arcpy.ListRasters()

 

arcpy.CreateFeatureclass_management(os.path.dirname(Dest),

                                   os.path.basename(Dest),

                                   "POLYGON")

arcpy.AddField_management(Dest,"RasterName", "String","","",250)

arcpy.AddField_management(Dest,"RasterPath", "String","","",250)

 

cursor = arcpy.InsertCursor(Dest)

point = arcpy.Point()

array = arcpy.Array()

corners = ["lowerLeft", "lowerRight", "upperRight", "upperLeft"]

for Ras in in_raster_datasets:

    feat = cursor.newRow() 

    r = arcpy.Raster(Ras)

    for corner in corners:   

        point.X = getattr(r.extent, "%s" % corner).X

        point.Y = getattr(r.extent, "%s" % corner).Y

        array.add(point)

    array.add(array.getObject(0))

    polygon = arcpy.Polygon(array)

    feat.shape = polygon

    feat.setValue("RasterName", Ras)

    feat.setValue("RasterPath", InFolder + "\\" + Ras)

    cursor.insertRow(feat)

    array.removeAll()

del feat

del cursor

 

 

that writes the Extents of a List of rasters that are in one folder to a Shapefile and adds the name of the raster to the attribute table. I would need the same function, but instead of the Extent

of each Raster with the Raster Domain

- to have the exact frame of each extracted georeferenced video still.

Because I do not completely understand the single steps... I do not know where to incorporate the arcpy.RasterDomain_3d...

Thanks a lot for help!

Attachments

Outcomes