|
POST
|
Thanks Barbara, I didnt know about that tool. v10 is so awesome!
... View more
08-20-2010
12:53 PM
|
0
|
0
|
809
|
|
POST
|
I would:
dirlist=os.listdir(r"C:\Arcwork")
mdblist=[]
for item in dirlist:
if item[-3:] in ['MDB','mdb']
mdblist.append(item)
its kind of wordy and a bit brute-force but it works 😛
... View more
08-20-2010
07:55 AM
|
0
|
0
|
2591
|
|
POST
|
Dan's tool contains the search cursors in the classes of the tool so you dont need to make a list of the field contents to use it. If you wanted to code out the stats yourself instead of using the tool you would make a list and do yourlist.append(row.getvalue("field")) in the while loop for the cursor. If you only need the stats provided by Dan's tool though I would use that as it will save you some lines in your script and make it cleaner looking. Kudos to you by the way Dan, that tool is a great solution to not having field stats in python.
... View more
08-19-2010
10:09 AM
|
0
|
0
|
1076
|
|
POST
|
For any one who uses for loops to batch run tools in python, I just got this monster working this morning. Though I would share.
#the list holding the field data is formated like so:
#[fieldname, targetlayer, jointable, expression, fieldmap],
#the greater list is broken to a new line at the comma at the end of each list inside it
fieldList=[
['backup_table.Co_FLU', r"C:\GIS Projects\CRW\parce_test_FeatureToPoint.shp", r'C:\GIS Projects\CRW\TrakIt_Source_RS.gdb\Input_Data\flu', '[parce_test_spatial_join.FLU_CODE]', "A1RENUM 'A1RENUM' true true false 15 Text 0 0 ,First,#,C:\GIS Projects\CRW\parce_test_FeatureToPoint.shp,A1RENUM,-1,-1;RE_LABEL 'RE_LABEL' true true false 15 Text 0 0 ,First,#,C:\GIS Projects\CRW\parce_test_FeatureToPoint.shp,RE_LABEL,-1,-1;FLU_CODE 'FLU_CODE' true true false 15 Text 0 0 ,First,#,C:\\GIS Projects\\CRW\\TrakIt_Source_RS.gdb\\Input_Data\\flu,FLU_CODE,-1,-1"],
[30 more lists go here but were cut for space reasons],
]
def dataLoad(field, targetlayer, jointable, expression, fieldmap):
gp.spatialjoin_analysis(targetlayer, jointable, r"C:\GIS Projects\CRW\parce_test_spatial_join.shp", "JOIN_ONE_TO_ONE", "KEEP_ALL", fieldmap,"INTERSECTS","0 Unknown","#")
gp.addjoin_management('parce_test', "A1RENUM", r"C:\GIS Projects\CRW\parce_test_spatial_join.shp", "A1RENUM", "KEEP_ALL")
gp.calculatefield_management('parce_test', field, expression, "VB", "#")
gp.removejoin_management("parce_test","parce_test_spatial_join")
gp.delete_management(r"C:\GIS Projects\CRW\parce_test_spatial_join.shp")
for parameter in fieldList:
dataLoad(parameter[0], parameter[1], parameter[2], parameter[3], parameter[4])
... View more
08-19-2010
09:19 AM
|
0
|
0
|
1107
|
|
POST
|
Batch in model builder is actually a condition of the inputs. If you right click on the add field tool and select to create a variable from an input then right click on the input and under its properties say that it is "A list of values." Now when you open that variable you have the ability to add in as many inputs as you need. Do this for every field you need to input from. As a warning though, this will make your output a batch output. From here out any tool you connect to that ouput will be a batch process.
... View more
08-19-2010
05:09 AM
|
0
|
0
|
809
|
|
POST
|
Well I think that the three forum GP break down would work for people who know what they want to do in a general sort of way but still leaves out the people who dont know where their post should go. We need an extra forum for people with "How should I do this?" questions. Their post may wind up being in a, b, or c but not until they know which avenue to go down. Forum a) Draggers & Droppers (The Dark Arts of Model Builder) Forum b) White space matters (Zen and the Art of ArcPy) Forum c) Far too much overhead (ArcObjects) Forum d) How do you spell geoprocessor? (General questions) Edit: I would like to add that a #GP may be a good idea. Its harder to moderate an IRC channel than a forum, but for syntax questions #python is very helpful and would cut out a lot of one post-one reply chatter.
... View more
08-18-2010
09:28 AM
|
0
|
0
|
778
|
|
POST
|
Are you running this outside of arcmap or from the python window? If you are running this in IDLE or something it may not work properly. To make this work, run the script from within arcmap and set the mxd to 'current'. This will give you the ability to refresh what you are actually looking at. The way you were doing it, you were editing the visibility of layers in a copy of the mxd that had been opened in memory by python. mxd=arcpy.mapping.MapDocument('CURRENT')
... View more
08-18-2010
04:39 AM
|
0
|
0
|
472
|
|
POST
|
Are you sure the once you downloaded is for python 2.6? Thats the only thing I can think of.
... View more
08-17-2010
09:25 AM
|
0
|
0
|
983
|
|
POST
|
I think that Bills "cross link" idea is good but contains a flaw. In my mind I see this as implimenting a crawler in the forum that indexes keywords from the posts instead of (or on top of) manual tagging. I think the only issue with this is that if the crawler isnt sophisticated enough it may see "You could do this with python instead of ArcObjects more quickly" in one post and "You should really be doing this with ArcObjects" in another and would put both into the ArcObjects forum. Another issue would be whether the crawler indexes on only the first post or on replys as well. Indexing both would solve the problem of a poster not knowing where to put their post, but could result in massive cross posting depending on how lively the replys get. A GP post could in theory wind up in python, MB, ArcObjects, and in the extension forums. In the end this is suggesting a robust auto-tagging system with the forums being querys on the tags instead of being traditional forums.
... View more
08-16-2010
07:37 AM
|
0
|
0
|
882
|
|
POST
|
Thanks a lot. Using the sde file as the workspace is just what I needed to know!
... View more
08-16-2010
06:17 AM
|
0
|
0
|
9355
|
|
POST
|
When you change layer visibility you need to refresh the map with arcpy.refreshactiveview() to see any changes. Any changes made to an mxd, as far as display goes, occur in memory and arent visible until you refresh the display.
... View more
08-16-2010
05:54 AM
|
0
|
0
|
472
|
|
POST
|
All I can find in the help for connecting to an SDE with arcpy is how to make a SDE connection file. I already have one of those because the SDE is available in catalog (C:\Documents and Settings\cmathers\Application Data\ESRI\ArcCatalog\OSA@sde@bay-gis.sde). I just want to know how to read that file with arcpy and then read some data from the server. How do I connect to the SDE from python?
... View more
08-13-2010
11:40 AM
|
0
|
2
|
26058
|
|
POST
|
You need to build the string outside of the tool perameters so that you can wrap parts of it in quotes for the tool. Remember this isnt just a string, its and SQL statement so you have to comply with SQL conventions. >>>where="UID <> \'" +str(uid) + "\' AND STATE = \'" +state +"\'" "UID <> 'oid' AND STATE = 'state'" gp.Select_analysis(USA_State, USA_State_Select, where)
... View more
08-13-2010
11:32 AM
|
0
|
0
|
871
|
|
POST
|
You dont want to make the change directly in the tool inputs. Make the string before and just drop it in as a variable. query="[ROADNAME] = '"+road+"'" gp.Select_analysis(a + "copySelect1", "Rclip" + a + "Select", query)
... View more
08-13-2010
04:46 AM
|
0
|
0
|
330
|
|
POST
|
Well the best way would be a tagging/sorting system. Users are prompted to tag their posts and replys and then other users can sort whole threads by the tags within. That way if someone asks a question and the disscussion turns to python, anyone looking for posts with a python tag will see those threads only. This would be implimented as "sub-forums" so that users could view the entire GP area or only those posts pertaining to thier interest. Sorry to be a fence sitter, but I think we should split and lump all at once! 😄
... View more
08-12-2010
05:21 AM
|
0
|
0
|
1304
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-03-2015 11:33 AM | |
| 1 | 09-23-2015 10:50 AM | |
| 1 | 12-14-2015 10:42 AM | |
| 1 | 12-14-2015 01:10 PM | |
| 1 | 12-04-2015 08:19 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|