本文整理汇总了Python中arcgisscripting.create函数的典型用法代码示例。如果您正苦于以下问题:Python create函数的具体用法?Python create怎么用?Python create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_mapsheets
def get_mapsheets(mask_fc, i_mapsheets, mapsheets_key, workspace):
"""
temporary fix for users with gdal 1.6 (arcgis 9.3)
local import of ArcGIS libraries
"""
import arcgisscripting
import turtlebase.arcgis
gp = arcgisscripting.create()
mapsheets = []
gp.MakeFeatureLayer_management(mask_fc, "mask_lyr")
gp.MakeFeatureLayer_management(i_mapsheets, "mapsheets_lyr")
gp.SelectLayerByLocation_management("mapsheets_lyr","INTERSECT","mask_lyr","#","NEW_SELECTION")
mapsheets_tmp = turtlebase.arcgis.get_random_file_name(workspace, '.shp')
gp.Select_analysis("mapsheets_lyr", mapsheets_tmp)
rows = gp.searchcursor(mapsheets_tmp)
row = rows.next()
while row:
mapsheets_value = row.GetValue(mapsheets_key)
ext = row.Shape.extent
mapsheets.append((mapsheets_value, ext))
row = rows.next()
return mapsheets
示例2: genETF
def genETF(self,rsLSTC,ThotD,Thot_cold,day,TcoldD,Thot1,Tcold1):
gp1 = arcgisscripting.create()
# Assign Paht variables
grid2 = self.tempPath+"grid2"
etf = self.tempPath+"etf"
finalEtf=self.etfPath
inTrueRaster=0
#print grid2
print"\n"
print "Extracted Variables: THOT1= "+str(Thot1)+ " & TCOLD1= "+str(Tcold1) +" (ONLY FOR TEST PURPOSE)"
print "Raster Name:"+str(rsLSTC)
print "Year of the Day:"+str(day)
print "Average Cold Pixel Value:"+str(TcoldD)
print "Average Hot Pixel Value:"+str(ThotD)
print "Differnce between Hot and Cold Pixels:"+str(Thot_cold)
# average hot pixel value - LSTc raster = raster grid2
print "Process: Minus..."
gp1.Minus_sa(ThotD,rsLSTC,grid2)
# raster grid2 / (average hot pixel value-average cold pixel value) = ETfgrid
print"Process: Divide..."
gp1.Divide_sa(grid2, Thot_cold, etf)
#set all values <0 to zero
print "Process: Con..."
gp1.Con_sa(etf, inTrueRaster,finalEtf+"etf2008"+str(day).zfill(3),etf, "VALUE < 0")
# deletes all intermediate rasters besides the output raster
gp1.Delete_management(grid2, "Raster Dataset")
gp1.Delete_management(etf, "Raster Dataset")
示例3: __init__
def __init__(self):
"""Setup the Geoprocessor and the list of tool parameters."""
import arcgisscripting as ARC
import os
self.os = os
self.GP = ARC.create(9.3)
self.params = self.GP.getparameterinfo()
示例4: ScratchFolder
def ScratchFolder():
"""Create a scratch folder
1) if current workspace is a folder, in the current workspace
2) if a .mdb or .gdb, parallel to it
3) in TEMP
"""
import arcgisscripting
gp = arcgisscripting.create()
try:
# this works at 10.1
sw = gp.scratchFolder
except:
try:
sw = gp.scratchWorkspace
swType = gp.Describe(sw).dataType
if swType == "Folder":
sw = os.path.join(sw,"scratch")
elif swType == "Workspace":
pth = os.path.dirname(sw)
if not gp.Exists(pth): raise
sw = os.path.join(pth,"scratch")
except:
# put it in TEMP
sw = os.path.join(os.environ["TEMP"],"scratch")
finally:
if not gp.Exists(sw):
os.mkdir(sw)
print "created " + sw
return sw
示例5: script
def script():
gp = arcgisscripting.create()
logging_config = LoggingConfig(gp)
# TODO: perhaps grab the logfile location from the config below.
parser = OptionParser()
(options, args) = parser.parse_args()
main(options, args)
logging_config.cleanup()
示例6: execute
def execute(self, parameters, messages):
#Obsolete, needs refactoring!
dwrite ("Starting sdmvalues");
gp = arcgisscripting.create()
TrainingSites = parameters[0].valueAsText
Unitarea = float( parameters[1].value)
appendSDMValues(gp, Unitarea, TrainingSites)
arcpy.AddMessage("\n" + "="*40);
arcpy.AddMessage("\n")
示例7: ReplaceFCstg
def ReplaceFCstg(fc,temp,fcname):
gp2 = arcgisscripting.create() # for some reason the script connection is dropped after restarting Oracle
if gp2.Exists(fc) and gp2.Exists(temp):
gp2.Delete_management(fc, "FeatureClass")
gp2.Rename_management(temp, fc, "FeatureClass")
logstr(' -- Replaced '+fcname)
'''else:
示例8: OnNext
def OnNext(self, event):
logging.debug("customer file is: "+self.export_stops_picker.GetValue())
logging.debug("ready to open progress")
self.wizard.next(Progress, message = 'Processing.....')
os.chdir(self.wizard.cwd)
# Create the geoprocessor object
gp = arcgisscripting.create()
Stops = (self.export_stops_picker.GetValue())
# Set the workspace for the processing files
gp.workspace = os.path.dirname(Stops)
示例9: gp_create
def gp_create(vers=None):
'''create the geoprocessor, 9.3, 9.2 or empty for win32com.client.Dispatch'''
if vers >= 9.2: #try 9.2 or above
try:
import arcgisscripting
gp = arcgisscripting.create(vers)
gp_version = vers
except:
import arcgisscripting
gp = arcgisscripting.create()
gp_version = 9.2
else:
try:
import win32com.client
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")
gp_version = 9.1
except:
gp = None
gp_version = 9.1
#
return [gp, gp_version]
示例10: get_geoprocessor
def get_geoprocessor(version):
try:
if version == 9.3:
# Try importing arcgisscripting, will fail if ArcGIS not present
# Raise the exception if not present
import arcgisscripting
return arcgisscripting.create(version)
elif version == 10:
import arcpy
return arcpy
except ImportError, e:
raise e
示例11: mainfunction
def mainfunction(dirbase, dirout, country, sres, period, resolution, tiled):
import arcgisscripting, os, sys, string, glob
gp = arcgisscripting.create(9.3)
# gp.CheckOutExtension("Spatial")
# gp.toolbox="management"
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
print " CONVERT TO ASCII AND TIFF "
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
varlist = "bio", "dtr", "prec", "tmean"
# modellist = sorted(os.listdir(dirbase + "\\SRES_" + sres + "\\" + country + "_" + resolution))
# for model in modellist:
model = "current"
for var in varlist:
gp.workspace = dirbase + "\\SRES_" + sres + "\\" + country + "_" + resolution + "\\" + model + "\\" + var
print "\n --> Processing: " + country,sres,model,period,var,"\n"
# diroutAscii = dirout + "\\SRES_" + sres + "\\" + country + "_" + resolution + "\\" + model + "\\" + var + "_asciis"
# if not os.path.exists(diroutAscii):
# os.system('mkdir ' + diroutAscii)
diroutTiff = dirout + "\\SRES_" + sres + "\\" + country + "_" + resolution + "\\" + model + "\\" + period + "\\" + var + "_tif"
if not os.path.exists(diroutTiff):
os.system('mkdir ' + diroutTiff)
rasters = gp.ListRasters("*", "GRID")
for raster in rasters:
# OutAscii = diroutAscii + "\\" + model + "_" + raster + "_1.asc"
OutTiff = diroutTiff + "\\" + sres + "_" + period + "_" + model + "_" + raster + ".tif"
# if not gp.Exists(OutAscii):
# gp.RasterToASCII_conversion(raster, OutAscii)
if not os.path.exists(OutTiff):
print "\tConverting " + raster
os.system("gdal_translate -of GTiff -ot Int32 -co COMPRESS=lzw -quiet " + gp.workspace + "\\" + raster + " " + OutTiff)
# gp.delete_management(raster)
else:
print "\tConverted " + raster
# trashList = sorted(glob.glob(diroutAscii + "\\*.prj"))
# for trashfile in trashList:
# os.remove(trashfile)
os.system("rmdir /s /q " + gp.workspace)
示例12: checkArcGIS
def checkArcGIS():
try:
import arcgisscripting
gp = arcgisscripting.create()
return gp
except:
try:
import win32com.client
gp = win32com.client.Dispatch('esriGeoprocessing.GpDispatch.1')
print ('ArcGIS 9.0 or 9.1 is installed')
return gp
except:
print ('sorry, cannot find an ArcGIS module. bailing...')
# Problem: Can't print this out to ArcGIS window if ArcGIS module can't be found!
示例13: zapusk3
def zapusk3 (c, source_control_points, target_control_points):
for i in c:
file = i + '_NGT.jpg'
file2 = i + '_NGT.jp2'
in_raster = 'Z:/SatData/Satimages/nonprojected/Mtsat/mtsat-2r/nrl/JAPAN/Geo-Color/'+ file
out_raster = 'Z:/SatData/Satimages/Project/Mtsat/mtsat-2r/nrl/JAPAN/Geo-Color/'+ file2
# Расстановка опорных точек
gp = arcgisscripting.create ()
ppp = gp.Warp_management (in_raster, source_control_points, target_control_points, out_raster, "POLYORDER2", "BILINEAR")
ccc = ppp
# Определение проекции
coordsys = "Z:/SatData/Satimages/Project/Mtsat/mtsat-2r/nrl/JAPAN/Geo-Color/Project/Mtsat_Japan_Geo_Color.img"
gp.DefineProjection_management (ccc, coordsys)
print gp.DefineProjection_management (ccc, coordsys)
示例14: Reproject
def Reproject(self):
print "upto here -->1"
rs=self.rasterFile
print rs
# Create Geoprocessing object
GP = arcgisscripting.create()
# set Toolbox
GP.toolbox = "management"
# Check out any License
GP.CheckOutExtension("spatial")
# Overwriting the Output
GP.OverwriteOutput =1
# Define Workspace
#GP.workspace="D:\\MODIS_ETa\\Output\\Eto_composite\\"
GP.workspace=self.compositeDir
# Assigning Projection types
#cs="C:\Program Files (x86)\\ArcGIS\\Coordinate Systems\\Projected Coordinate Systems\\Continental\\North America\\North America Albers Equal Area Conic.prj"
cs=self.projection
#coordsys="C:\\Program Files (x86)\\ArcGIS\\Coordinate Systems\\Geographic Coordinate Systems\\North America\North American Datum 1983.prj"
coordsys=self.datum
print "Try to define Projections........."
## Define the projection and Coordinate System
GP.defineprojection(rs, coordsys)
print "Definition completed........."
try:
print "Try to reproject raster "+rs
##Reproject Raster into Albers Equals Area
#GP.ProjectRaster_management(InFileName, OutFileName, out_coordinate, resample, cell, geo_tran, reg_point, in_coordinate)
GP.ProjectRaster_management(rs,self.reprojectDir+"PrjETo"+str(self.year)+str(self.yearDay).zfill(3),cs,"NEAREST",self.sampleSize,"","",coordsys)
print "Reprojection Done"
print "upto here -->2"
except:
GP.GetMessages()
raise "exit"
示例15: convertRasterToNetCDF
def convertRasterToNetCDF(inputRasterFile, outNetCDFFile, dataSetVariableName):
variable = dataSetVariableName #"tmin"
units = "" #actual unit for temperature data is 'deg C' but this unit does not work with netcdf create function - correct unit is set after the file is created
XDimension = "x"
YDimension = "y"
bandDimension = "time"
# Create the Geoprocessor object
gp = arcgisscripting.create()
# Check out any necessary licenses
gp.CheckOutExtension("spatial")
gp.RasterToNetCDF_md(inputRasterFile, outNetCDFFile, variable, units,
XDimension, YDimension, bandDimension)
# check in any necessary licenses
gp.CheckInExtension("spatial")