Exemplo n.º 1
0
def returnParentFolder(path):
     desc = arcpy.describe(path)
     while not desc.datatype == 'Folder':
         path = os.path.dirname(path)
         desc = arcpy.describe(path)

     return path
Exemplo n.º 2
0
def returnParentFolder(path):
    desc = arcpy.describe(path)
    while not desc.datatype == 'Folder':
        path = os.path.dirname(path)
        desc = arcpy.describe(path)

    return path
Exemplo n.º 3
0
 def makeFeatureLayer(self, loseglobalid=None):
     # print arcpy.env.workspace
     fieldInfo = arcpy.describe(self.path).fieldInfo
     featLyr = arcpy.CreateUniqueName("featLyr", "in_memory")
     # print featLyr
     if loseglobalid is not None:
         print "lose my globalid!"
     arcpy.MakeFeatureLayer_management(self.path, featLyr, "#", "#", fieldInfo)
     return featLyr
Exemplo n.º 4
0
env.workspace = "C:/EsriPress/Python/Data\Exercise09"
raster = "landcover.tiff"
desc = arcpy.describe(raster)
x = desc.MeanCellHeight
y = desc.MeanCellWidth
spatialref = desc.spatialReference
units = spatialref.linearUnitName
print "Cells are" + str(x) + " by " + str(y) + " " + units + "."

"""

import arcpy
from arcpy import env
env.workspace = "C:/EsriPress/Python/Data/Exercise09"
raster = "landcover.tiff"
desc = arcpy.describe(raster)
x = desc.MeanCellHeight
y = desc.MeanCellWidth
spatialref = desc.spatialReference
units = spatialref.linearUnitName
print "Cells are" + str(x) + " by " + str(y) + " " + units + "."


"""

    Line 3: The backspaces in the path name setting workspace should all be forward slashes
    Line 4: .tiff is not a valid file type, the proper ending shouild be .tif
    Line 5: the .Describe method is suppose to be capitalized
    Line 6: Mean in desc.MeanCellHeight statement should be lowercase
    Line 7: Mean in desc.MeanCellWidth statement should be lowercase
    Line 8: spatial in desc.spatialReference shoule be capitalized to Spatial.
import arcpy
from arcpy import env

env.workspace = "C:/EsriPress/Python/Data\Exercise09"
raster = "landcover.tiff"
desc = arcpy.describe("raster")
x = desc.MeanCellHeight
y = desc.MeanCellWidth
spatialref = desc.spatialReference
units = spatialref.linearUnitName
print "Cells are" + str(x) + " by " + str(y) + " " + units + "."
Exemplo n.º 6
0
import arcpy
from arcpy import env
env.workspace = "C:/EsriPress/Python/Data/Exercise11"
fclist = arcpy.ListFeatureClasses()
for fc in fclist
    desc = arcpy.describe(fc)
    print desc.basename + ": " + des.shapeType