|
POST
|
Issue appears to have been fixed either in 10.1 SP1 or 10.2.
... View more
10-29-2013
08:06 AM
|
0
|
0
|
1190
|
|
POST
|
When does this occur? In what method? Does it give any more information? Do the items you assign in __init__ show up in the combobox? What version of ArcGIS are you using?
... View more
10-29-2013
07:52 AM
|
0
|
0
|
1190
|
|
POST
|
os.startfile and webbrowser.open use COM to do their thing, and they expect the COM runtime to be initialized differently from how ArcGIS does it. You can get around it by calling the function in a different thread.
def open_browser(url):
import threading
import webbrowser
threading.Thread(target=webbrowser.open, args=(url,)).start()
... View more
10-25-2013
06:46 AM
|
0
|
1
|
991
|
|
POST
|
Mark the format string as unicode (with a u beforehand u"like this") so it doesn't try to downcast your Norwegian characters to ascii.
ISs = da.SearchCursor("ISpoint_lyr", "*")
for IS in ISs:
propStr = u""
for index in range(len(ISs.fields)):
if index <> shapeFieldIndex:
propStr += u";{0}".format(IS[index])
... View more
10-24-2013
08:32 AM
|
0
|
0
|
596
|
|
POST
|
updateRow[1] = lutDict[nameValue] Still don't quite understand what you're doing here.
... View more
10-22-2013
03:33 PM
|
0
|
0
|
1236
|
|
POST
|
You're mixing up arcpy.SearchCursor and arcpy.da.SearchCursor, among other issues (missing closing parens, indentation). import arcpy lutTbl = r"Database Servers\CLINTONCOOPER_SQLEXPRESS.gds\VOTERS_20133 (VERSION:dbo.DEFAULT)\VOTERS_20133.DBO.frequency" mainTbl = r"Database Servers\CLINTONCOOPER_SQLEXPRESS.gds\VOTERS_20133 (VERSION:dbo.DEFAULT)\VOTERS_20133.DBO.OHIO_VOTERS_GEOCODE_OCT142013_small" lutDict = {r[0]: r[1] for r in arcpy.da.SearchCursor(lutTbl, ["FULL_ADDRESS","FREQUENCY"])} with arcpy.da.UpdateCursor(mainTbl, ["FULL_ADDRESS","FREQUENCY"]) as updateRows: for updateRow in updateRows: nameValue = updateRow[0] if nameValue in lutDict: updateRow[1] = lutDict[nameValue][0] #Address updateRows.updateRow(updateRow)
... View more
10-22-2013
02:23 PM
|
0
|
0
|
1236
|
|
POST
|
You haven't cast your x/y values into floats like the DLL documentation asks. I very, very, very strongly recommend you read the ctypes documentation's section on specifying the input/return types in an imported function. This way the arguments will be sanity-checked before calling the functions in the DLL. For example, SetXIn = corpslib.SetXIn
SetXIn.argtypes = [ctypes.c_double]
SetXIn.retval = ctypes.c_int
SetXIn(2790955)
... View more
10-22-2013
01:22 PM
|
0
|
0
|
1080
|
|
POST
|
import collections
def has_duplicates(list_of_values):
value_dict = collections.defaultdict(int)
for item in list_of_values:
value_dict[item] += 1
return any(val > 1 for val in value_dict.itervalues())
if has_duplicates(my_list):
print "The list provided contains duplicate values"
else:
print "The list provided does not contain duplicate values."
... View more
10-22-2013
08:52 AM
|
1
|
0
|
5819
|
|
POST
|
I don't think it's directly supported, but you could add a filter function like this: def filter_function(walk): for dirname, subdirs, items in walk: new_items = [] for item in items: description = arcpy.Describe(os.path.join(dirname, item)) if description.dataType == "FeatureClass": if description.featureType != "Annotation": new_items.append(item) else: new_items.append(item) yield dirname, subdirs, new_items for dirpath, dirnames, filenames in filter_function(arcpy.da.Walk(workspace)): # Something interesting goes here
... View more
10-21-2013
09:42 AM
|
0
|
0
|
703
|
|
POST
|
import arcpy
city_pts = "C:\Urban_Land_Project\Cities\WI_cities.shp"
buffer_sizes = [1,2,4,7,10,15,20,30]
for distance in buffer_sizes:
out_shape = "C:\Urban_Land_Project\City_buffers\WI_city_buffers{}km.shp".format(distance)
out_km = "{} Kilometers".format(distance)
arcpy.Buffer_analysis(city_pts, out_shape, out_km, "FULL", "ROUND", "NONE", "#")
... View more
10-21-2013
09:37 AM
|
0
|
0
|
615
|
|
POST
|
Since those layers can change from map to map, why not use a function instead of global variables? def get_layers(): mxd = arcpy.mapping.MapDocument("current") df = arcpy.mapping.ListDataFrames(mxd)[0] layers = { 'footprints_fc': None, 'parcels_fc': None } for layer in arcpy.mapping.ListLayers(mxd): if "Footprints_Edit" in layer.name: layers['footprints_fc'] = layer elif "Parcels_Edit" in layer.name: layers['parcels_fc'] = layer # ad nauseam return layers Then in each onclick, you'd do something like this: layers = get_layers footprint_layer = layers['footprints_fc'] parcel_layer = layers['parcels_fc'] and it'd always be up-to-date.
... View more
10-17-2013
01:00 PM
|
0
|
0
|
566
|
|
POST
|
arcpy.management.<function>() and arcpy.<function>_management() are functionally equivalent, it's a matter of personal preference. Once it's an add-in, just calling the tool should add it to the TOC without the AddLayer part.
... View more
10-17-2013
12:14 PM
|
0
|
0
|
1146
|
|
POST
|
How are you running this code? As a script tool? Try this: field = 'FILENAME' cursor = arcpy.SearchCursor(myRefLayer) for row in cursor: fullpath = row.getValue(field) path = os.path.dirname(fullpath) name = os.path.basename(fullpath) addLayer = arcpy.management.MakeRasterLayer(path, name)[0] arcpy.mapping.AddLayer(df, addLayer, 'TOP')
... View more
10-17-2013
10:43 AM
|
0
|
0
|
1146
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-26-2012 02:46 AM | |
| 2 | 01-06-2011 08:22 AM | |
| 1 | 03-25-2014 12:18 PM | |
| 1 | 08-12-2014 09:36 AM | |
| 1 | 03-31-2010 08:56 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:22 AM
|