Reputation
Top tag
Next privilege 2,500 Rep.
Create tag synonyms
Badges
3 16
Newest
 arcpy
Impact
~21k people reached

7h
comment Python toolbox tool objects do not remember instance variables between function calls?
I made an edit to my question. You are right, it is spinning up a crazy amount of instances! This is not desirable behavior.
7h
comment Python toolbox tool objects do not remember instance variables between function calls?
For your number (1), I think you must be right. The values should be remembered if it were the same instance; I am just not sure why Esri would implement it this way. From the base logic of their templates, it would seem it would all be contained within ONE instance. For (2), I believe it will call UpdateParameters every time a parameter is changed, so yes, it should be True every time something is changed. Another option could be to make an Add-In where this behavior is controlled by combo boxes.
Jul
30
comment How to set output parameter to a zip file in a custom geoprocessing function tool?
That's a good question. I am not sure. To me it seems like they should both work. DEFile is from esriDataSources so maybe it is better recognized as a data source. On the other hand, GPDataFile is from Geoprocessing, which seems like it would be a better option to use for a tool parameter. Both support the IGPValue interface as well.
Jul
28
comment How to set output parameter to a zip file in a custom geoprocessing function tool?
Have you tried using the DEFile Class instead? It supports the IGPValue interface. This is designed for GP parameters. help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/…
Jul
28
comment How to check for empty values in fields of a featureclass?
Note, the second fields sample may be kind of slow using the 10.0 cursors, could handle it much faster if you had access to the arcpy.da cursors introduced at version 10.1
Jul
26
comment How do I get JSON data into Python script from a ArcGIS geoprocessing service?
Awesome! I just added a bunch more functionality, including a way to export a result feature set if the gp task has one. Hopefully it works for you.
Jul
24
comment map(arcpy.AddError, traceback.format_exc().split(“\n”))
I have an answer explaining the map portion, but it seems like an error with the traceback if it returns ['None', ''] or no error at all?? In the latter case, the exception wouldn't be called in the first place. That seems strange.
Jul
24
comment Python tools won't open when clicked on
It probably isn't recognizing it as a proper PYT because you have the methods it is looking for commented out. Try un-commenting them.
Jul
16
comment Fill in NoData gaps in raster using ArcGIS for Desktop?
You would be better off using the arcpy.sa.NbrCircle(radius, units) where the units can either be 'MAP' or 'CELL'.
Jul
14
comment Why is Python AddIn toolbar showing all “Missing” tools/buttons?
One problem I see is that in the CalcDrainArea class you're setting the shape attribute to an arcpy.Polygon. The pythonaddins module is looking for Circle, Line, or Rectangle. Also, as @Paul suggested, having the python window open will show bugs.
Jul
8
comment Use Python to Find duplicate values in a feature Class and populate a field
Take the second code sample I provided and change the fc, fld, and up variables appropriately and it should work.
Jul
8
comment Use Python to Find duplicate values in a feature Class and populate a field
the inShapefile variable needs to point to a full data source path of your shapefile or feature class. Like this: inShapefile = r"C:\TEMP\test.shp"
Jul
8
comment Use Python to Find duplicate values in a feature Class and populate a field
That's a good point. I'm too attached to dictionaries sometimes.
Jul
7
comment Draw polygon with GUI
One disclaimer about the onLine method to draw a line from a Python Add-In is that it does not allow snapping, where the FeatureSet with a script tool can use snapping. If you really need the snapping from an Add-In perspective, you may need to consider doing it in .NET.
Jun
25
comment Creating polygon geometry using points array
Ah, I should point out that my suggestion only works for version 10.1 and beyond. Sorry for the confusion.
Jun
25
comment Creating polygon geometry using points array
Yes, I would do as Vince says and add a spatial reference, otherwise the polygon has no idea where it is supposed to be. Also, you can set up the wgs by passing in a well-known ID (WKID) rather than referencing a .prj file: wgs = arcpy.SpatialReference(4326)
Jun
16
comment Using Google API within Python and applying to ArcMap?
Haha, in @ian's defense, an edit was made to this question after he posted that asking how to get it into a toolbox.
Jun
15
comment Guidelines for using ArcObjects from Python
Thanks @Michael Miles-Stimson. I will give it another shot. If I can't figure it out, I'll post a new question with my current code.
Jun
12
comment Guidelines for using ArcObjects from Python
Wow, thank you so much for posting this! I have had some struggles understanding the ArcObject Diagrams. It is nice to have some input from someone like yourself who comes from the other side of the fence (lots of .NET ArcObjects experience). One thing I have had some difficulties with is accessing a feature class that resides in a feature dataset via comtypes and python. I think in the past I have tried opening the feature data set first and then the feature class but didn't have any luck (getting some null pointers). Do you have any python samples for that?
Jun
11
comment Arcpy scripts run time dialog keeps deactivating tkinter window
After reading your post again, you could try introducing a bit more logic into your script tool. For example, you could have an optional parameter that allows the user to enter any extra field names not found in the target feature using a String data type as a multiple input parameter.