|
POST
|
You aren't getting a list since you specify the index position of your data frame. This returns the first data frame. df = arcpy.mapping.ListDataFrames(mxd)[0] This returns a list of all data frames. df = arcpy.mapping.ListDataFrames(mxd)
... View more
08-22-2012
09:08 AM
|
0
|
0
|
3056
|
|
POST
|
Are you sure you don't want to work with your current map document? Try listing the layers to make sure you get what you expect. layers = arcpy.mapping.ListLayers(mxd2,"",df2) for layer in layers: print layer
... View more
08-16-2012
02:46 PM
|
0
|
0
|
1686
|
|
POST
|
This should do what you want. Where var is your string. var.split(" ")[:-1] If the portion of the string you are trying to remove is always the same length, you could also use the simpler. var[:-6]
... View more
08-16-2012
10:48 AM
|
1
|
0
|
5332
|
|
POST
|
Further to what Christopher said, you want to extract your feature class data of interest using your cursor, and then access that outside the cursor. Here is an example using a dictionary. import arcpy
# set environments
arcpy.env.workspace = "Path"
arcpy.env.overwriteOutput = True
#set parameters
featureTable="Individual_catchments"
baseFeature="elevation"
temp_featureTable = r"in_memory\temp1"
temp_baseFeature = r"in_memory\temp2"
temp_featureClass = r"in_memory\temp_fc"
temp_layer = r"in_memory\temp"
arcpy.MakeFeatureLayer_management(featureTable, temp_featureTable)
arcpy.MakeFeatureLayer_management(baseFeature, temp_baseFeature)
arcpy.MakeFeatureLayer_management(featureClass, temp_featureClass)
# Get OID field name
f_list = arcpy.ListFields(temp_featureClass)
for f in f_list:
if f.type == "OID":
f_oid = f.name
# Set Dictionary
feat_dict = {}
#set cursor
rows = arcpy.SearchCursor(temp_featureClass)
# loop
for row in rows:
feat_dict[row.getValue(f_oid)] = row.getValue("Local")
for id in feat_dict:
arcpy.MakeFeatureLayer_management(temp_featureClass, temp_layer, "%s = %s" % (f_oid, id))
arcpy.Clip_management(temp_baseFeature, "#", "catch%s.tif" % (feat_dict[id]), temp_layer, "0", "ClippingGeometry")
... View more
08-16-2012
05:44 AM
|
0
|
0
|
2155
|
|
POST
|
Correct, you will need the 32 bit version. I am pretty sure I just used the exe to install, but there shouldn't be an issue either way.
... View more
08-15-2012
08:18 AM
|
0
|
0
|
1929
|
|
POST
|
PyScripter is what I use for 10.1 without any issues.
... View more
08-15-2012
08:04 AM
|
0
|
0
|
1929
|
|
POST
|
Thanks mzcoyle for the clarification. Do you know off hand if sde connections are stored by default in the "C:\\Documents and Settings\\user\\Application Data\\ESRI\\Desktop10.0\\ArcCatalog\\" folder in XP? Yes they should be.
... View more
08-14-2012
06:56 AM
|
0
|
0
|
945
|
|
POST
|
This will work regardless of windows version or settings. path = os.path.join(os.getenv("APPDATA"), r"ESRI\Desktop10.0\ArcCatalog")
... View more
08-14-2012
06:17 AM
|
0
|
0
|
945
|
|
POST
|
def calc(DepthMin):
if DepthMin > 2:
return 2
calc( !DepthMin! )
... View more
08-09-2012
02:57 PM
|
0
|
0
|
1189
|
|
POST
|
Well that throws a wrench in things, thanks for posting this so I have time to make some much needed changes before I even start the switch over to 10.1. How does this impact the project tool? In 10.0 I would do essentially something like this.
outCS = os.path.join(installDir,r"Coordinate Systems\Projected Coordinate Systems\National Grids\Canada\NAD 1983 CSRS UTM Zone 12N.prj")
inCS = os.path.join(installDir,r"Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj")
arcpy.Project_management(in_fc, out_feature, outCS, transform_method, inCS) In 10.1 would look like this? inCS = arcpy.SpatialReference()
inCS.factoryCode = some_code1
inCS.create()
outCS = arcpy.SpatialReference()
outCS.factoryCode = some_code2
outCS.create()
arcpy.Project_management(in_fc, out_feature, outCS, transform_method, inCS)
... View more
08-09-2012
07:23 AM
|
0
|
0
|
2572
|
|
POST
|
There is a fix for this in 10.0 SP5 and 10.1. HowTo: Set the default Home folder and geodatabase location for new map documents Of course this requires getting SP5 installed! If you are hacking the registry anyways, you can accomplish 90% of that in any version of 10.0. You can set the default geoprocessing output to any gdb location you want.
... View more
08-08-2012
02:35 PM
|
0
|
0
|
2913
|
|
POST
|
Please keep in mind that we can't include everything requested as there is a lot of work in testing and integration for each library ([Windows|Linux]x[32 bit|64 bit]x[Many other factors]). Completely understandable, and they don't necessarily have to be default installs. It would be nice to have them as options where it is clear to the user/installer that these are not directly supported, third party modules, and to use at your own risk. It would also be nice to know (I haven't seen any resource for this yet) examples of third party modules and use cases popular internally with Esri, even if they are not standard or supported.
... View more
08-08-2012
02:14 PM
|
0
|
0
|
2913
|
|
POST
|
Ah yes, makes sense. Doesn't really matter if they are positive or negative if they are the same absolute value anyways.
... View more
08-08-2012
12:21 PM
|
0
|
0
|
1300
|
|
POST
|
Matt - I guess I have a tweak:
tv = arcpy.MakeTableView(table)
curs = arcpy.SearchCursor(tv)
listing = list() # create a list
for row in curs:
listing.append(row.min_value)
del row, curs # always a good idea when done!
xmin = min([abs(i) for i in listing])
# now get that record (or the first if several) with that abs value
curs = SearchCursor(tv,"abs(%s) = %s" % (min_value,xmin))
# get the value for field "shapefile"
shapefile = curs.next().shapefile
del curs
Looks good, much more fleshed out. Maybe I am missing something though, this doesn't seem to preserve the negative sign with the xmin assignment.
... View more
08-08-2012
12:05 PM
|
0
|
0
|
1300
|
|
POST
|
pywin32 specifically the win32api. I like to use it for quasi OS authentication by accessing active directory user names and permissions. As a custom install right now it is a hassle to package it with the standard deployment.
... View more
08-08-2012
11:42 AM
|
0
|
0
|
2913
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-17-2011 10:36 AM | |
| 1 | 08-16-2012 10:48 AM | |
| 1 | 10-31-2012 08:39 AM | |
| 1 | 07-16-2012 01:52 PM | |
| 1 | 03-15-2012 10:57 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-22-2024
11:12 PM
|