1,215 reputation
312
bio website
location Mankato, MN
age 27
visits member for 2 years, 5 months
seen 16 hours ago

2d
comment Divide polygons into *n* number of groups of equal counts with ArcGIS 10.2
Have a look at this post. You would have to tweak the code a little bit to fit your needs but this is the general idea.
Jan
20
comment Write GeoJson into a .geojson file with Python
Can you show the logic for the class? I would recommend working with the json module.
Jan
14
comment Trying to update separate table with SearchCursor
You need to use an UpdateCursor to accomplish this.
Jan
12
comment Select layer by attribute for entries in a dictionary (python)
Can you post your code?
Jan
8
comment Edit or update ArcGIS Online Web Map data using the REST API
@amarinel Sorry, I misunderstood your question. You can probably just append a bookmark to the list of bookmarks through a python POST request. I edited my question to show an example from the link you provided. I am not 100% sure if this will work though.
Jan
8
comment Guidelines for using ArcObjects from Python
@Luke This is cool, I have never seen this before.
Jan
7
comment Guidelines for using ArcObjects from Python
Also, I purchased this book last year: amazon.com/Beginning-ArcGIS-Desktop-Development-using/dp/…
Jan
7
comment Guidelines for using ArcObjects from Python
I edited my original answer to try to answer your questions. I have a few other examples as well, but the above snippet is probably the most readable.
Jan
6
comment User interaction with Python tool midway through script running?
One disclaimer...everyone who uses this will also have to install wxPython on their machines or you can put the wx-3.0msw folder in a shared location along with the wx.pth and wxversion.py and use sys.append(path) to make sure it is always imported properly in the script.
Dec
22
comment List all feature layers
No problem, using the globals() will return a dictionary of the variable names and their respected values. The dir() returns a list of the variables. The line you are asking about is just a list comprehension that checks to see if the variable type is an arcpy.mapping.Layer, which is the data type returned from the MakeFeatureLayer() function. If a variable is of the layer type, it is added to the list.
Dec
15
comment name 'row' is not defined error appears overnight
That is strange, I do not know why it would say "porow" is not defined. Are there any feature classes with 0 records? Maybe you could do a try: del porow, except: pass, finally: del pocursor. That way at least the cursor object gets deleted at every iteration and it should not fail with that error.
Dec
15
comment name 'row' is not defined error appears overnight
Try moving your MakeFeatureLayer outside of the loop and remove the clear selection and Delete_management() routines at the end. It should take on a new selection every time.
Dec
15
comment name 'row' is not defined error appears overnight
Can you post your full error message?
Dec
9
comment Merge tif files with python
Just a thought, setting sys.argv as you are may be causing a problem. sys.argv[0] is always the path of the current script running. Whenever I pass in args in this way I usually do sys.argv[1:] = [#your args here]. I should add that when I do that, it is when using ArcGIS/arcpy so it may not apply for gdal.
Dec
5
comment Set default values for value table in Python Toolbox tool
Beautiful! I can't believe I missed that...It seems so obvious. Thank you very much!
Dec
4
comment Arcpy SelectByAttributes and Show Selection
I just edited my original answer to include that information. I hope it helps.
Dec
4
comment Arcpy SelectByAttributes and Show Selection
There is, you can just set the mxd variable to be the current map like this: mxd = arcpy.mapping.MapDocument('current'). You could also set up validation to list the layers in the mxd as a drop down then have a where clause parameter to give you the Select By Attribute GUI, which would be obtained from the layer you choose.
Dec
4
comment Arcpy SelectByAttributes and Show Selection
Yes, but if you are using a stand alone script the map has to be closed. You have to reference the layer by name using the lyr = arcpy.mapping.ListLayers(mxd, 'layer name')[0]. Once you have referenced the layer, you can run the select by attribute and then save the map using mxd.save(). Next time you open it, there should be a selection.
Dec
3
comment Set default values for value table in Python Toolbox tool
Thanks for the suggestion. I tried that in the getParameterInfo() method with both adding rows to the vt param object itself and creating a new value table, adding the rows and setting the vt.value to the new value table with still no luck. I don't think I can use this in the ReorderFields instantiation because the fields are dependent on an input feature class. Maybe I can make a value table object in the init and try setting the vt.value to the self.valueTable once the rows have been populated.
Nov
21
comment Converting personal geodatabase .mdb file to .gdb
You should be able to do this without any scripting. Just create a new file geodatabase, and by using ArcCatalog you can select all the feature data sets/feature classes in the personal gdb and copy and paste them into the new file gdb.