|
POST
|
Set your input /output feature classes as model parameters.
... View more
08-24-2014
02:36 AM
|
0
|
0
|
927
|
|
POST
|
I know that Curtis, but your original title is "Cannot import pandas - ArcGIS 10.1" and you specified "ArcGIS 10.1 SP 1" in the body of the post. That's why I questioned the path.
... View more
08-13-2014
05:59 PM
|
1
|
2
|
3085
|
|
POST
|
Is "C:\Python27\ArcGIS10.2"in your traceback just a typo, or have you got/had multiple installs or something else funky going on?
... View more
08-12-2014
07:38 PM
|
0
|
5
|
3085
|
|
POST
|
Is this your full code? Do you have any try/except clauses in there that might be hiding earlier exceptions? I can't see how you would even get to `arcpy.mapping.AddLayer(newdf,addlayer,"AUTO ARRANGE")` as the `addlayer = arcpy.mapping.Layer(lyr)` would raise an exception anyway as `lyr` is a layer object, not a string. Also, the AddLayer method will raise an exception as "AUTO ARRANGE" is an invalid value, it must be one of ['TOP', 'AUTO_ARRANGE', 'BOTTOM'] Note the "_" underscore in "AUTO_ARRANGE". Here is some code to get you started: import arcpy
thisMap = arcpy.mapping.MapDocument("CURRENT")
myDF = arcpy.mapping.ListDataFrames(thisMap)[0]
if not arcpy.Exists(r"D:\GIS_data\test"):
arcpy.CreateFolder_management(r"D:\GIS_data", "test")
templatemap = arcpy.mapping.MapDocument(r"D:\GIS_data\template.mxd") #an existing empty mxd
templatedf = arcpy.mapping.ListDataFrames(templatemap)[0]
myLayers = arcpy.mapping.ListLayers(myDF,"CNNDB")
if myLayers:
arcpy.mapping.AddLayer(templatedf,myLayers[0],"AUTO_ARRANGE")
templatemap.saveACopy(r"D:\GIS_data\test\new.mxd")
newmap=arcpy.mapping.MapDocument(r"D:\GIS_data\test\new.mxd")
Notes: arcpy.mapping.MapDocument requires an existing MXD, it can not create a new one. Use an empty mxd as a template. You can pass a layer name (or partial name + wildcard *) to the arcpy.mapping.ListLayers method.
... View more
08-07-2014
07:10 PM
|
3
|
1
|
2171
|
|
POST
|
@Ahmed that is not correct. For loops do not have their own namespace, so the variable is in the local scope. Consider this: for i in range(2):
loopvar = i * 2
print 'loopvar was defined in the loop and its value is {0}'.format(loopvar)
The above code snippet works fine and prints: loopvar was defined in the loop and its value is 2
... View more
08-07-2014
05:59 PM
|
1
|
2
|
2171
|
|
POST
|
You could replace:
FieldValDict = {}
for y in range(1,x):
FieldValDict = row
With:
FieldValDict = dict(zip(fields[1:], row[1:]))
... View more
07-18-2014
05:36 PM
|
0
|
0
|
1025
|
|
POST
|
Thank you, I again tried your code of course with a little change and fortunately this time it was work. That's good. Please click the check mark next to my post to indicate it answered your question. I plan to do this work about about Fuzzy membership and Weighted sum with 5 layer. can you help me about these? You should start a new thread with your new question.
... View more
06-24-2014
12:15 PM
|
0
|
0
|
1026
|
|
POST
|
Use the Raster class to create a Raster object from your input filename. Try: import arcpy from arcpy import env from arcpy.sa import * import os arcpy.env.overwriteOutput = True # Get the input parameters for inPath = arcpy.GetParameterAsText(0) constant = int(arcpy.GetParameterAsText(1)) #convert to integer outPath = arcpy.GetParameterAsText(2) # Run the Divide tool result = Divide(Raster(inPath),constant) result.save(os.path.join(outPath, "someraster")) # Report a success message arcpy.AddMessage("All done!")
... View more
06-24-2014
12:11 AM
|
0
|
0
|
1026
|
|
POST
|
I like http://learnpythonthehardway.org (and it's not as hard as the title suggests)
... View more
06-22-2014
10:39 PM
|
2
|
0
|
1210
|
|
POST
|
GDA 1994 MGA Zone 55 is a projected (UTM) coordinate system not geographic.
... View more
06-22-2014
09:49 PM
|
0
|
0
|
1109
|
|
POST
|
I also change the name of my rasters to the fullpath: RE_suitable_dek001:9.4 to r'Fullpath\RE_suitable_dek001:9.4 I also read this method in your post but I think you have already removed it in the thread. I removed that post as I reread your original post and saw you were already using the full path in your script: rasters = [os.path.join(raster_ws, r) for r in arcpy.ListRasters()] But I forgot that you didn't use the full path in your rastVal lookup dictionary. Please click the big check mark next to one of the above answers to indicate they answered your question.
... View more
06-22-2014
05:36 PM
|
0
|
0
|
2344
|
|
POST
|
Change your for loop from for rast in rastVal: To: for rast in rasters: Then this should work: outRaster = Raster(rast) / rastVal[rast] * 100
... View more
06-18-2014
11:32 AM
|
0
|
0
|
2344
|
|
POST
|
You either need to set the workspace to the location of the rasters (arcpy.env.workspace = path to rasters) or pass the full pathname when creating the Raster object i.e Raster(os.path.join(path to raster, rasterfilename))
... View more
06-18-2014
11:23 AM
|
0
|
0
|
2344
|
|
POST
|
Oh I get you. Use the parameterDependencies attribute. def getParameterInfo(self):
'''parameter definitions for GUI'''
params =[]
params.append(arcpy.Parameter(
displayName='GPFeatureLayer1',
name='GPFeatureLayer1',
datatype='GPFeatureLayer',
parameterType="Required",
direction="Input"))
params.append(arcpy.Parameter(
displayName='Field1',
name='Field1',
datatype='Field',
parameterType="Required",
direction="Input"))
#this will automatically update the fields list with fields from param[0]
params[1].parameterDependencies = [params[0].name]
... View more
06-16-2014
04:20 PM
|
1
|
0
|
1400
|
|
POST
|
You're trying to use a list in your expression instead of a Raster object. Change this: outRaster = rasters / rastVal[rast] * 100 To this: outRaster = Raster(rast) / rastVal[rast] * 100 http://resources.arcgis.com/en/help/main/10.2/index.html#//018z00000051000000
... View more
06-16-2014
02:52 AM
|
0
|
0
|
2344
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-24-2022 03:08 PM | |
| 1 | 07-30-2025 03:00 PM | |
| 1 | 06-10-2025 08:06 PM | |
| 5 | 05-20-2025 07:56 PM | |
| 1 | 05-04-2025 10:34 PM |