POST
|
If I understand correct: your script-tool is supposed to create and populate a field that you will later buffer with? You problem is that when you are creating the model, you want to select the buffer distance from field option, but it is not showing up. It appears blank because the tool has not run and the field does not yet exist in the dataset. You can create a dummy output or copy your data, then run the model ( which runs the tool) to create the field. The model will stop at the buffer tool because it can't go further without knowing which field you want to buffer from. Hopefully then you can complete the model and it will work fine for future iterations.
... View more
09-16-2010
04:44 AM
|
0
|
0
|
3
|
POST
|
step 1 - create new field = rv_type step 2 - create new field = rg_type step 3 - select by attributes features with type = rv step 4 - calculate rv_type = rv step 5 - select by attributes features with type = rg step 6 - calculate rg_type = rg step 7 - union overlapping features step 8 - Select features by attribute... SQL WHERE: rv_type = "rv" AND rg_type = "rg" step 9 - calculate type field = "rv and rg" step 10 - Delete rv_type, Delete rg_type
... View more
09-15-2010
11:16 AM
|
0
|
0
|
1
|
POST
|
I don't know anything about ArcPy or SDE servers, but perhaps you are having difficulties in the way your are populating your lists and the code structure? I might change your code to the following... but thats for python not ArcPy? Are they very different?: mxd = arcpy.mapping.MapDocument(fullpath) DFList = [] while arcpy.mapping.ListDataFrames(mxd): DFinsert = arcpy.mapping.ListDataFrames(mxd) DFList.append(DFinsert) lyrList = [] for df in DFList: lyrInsert = arcpy.mapping.ListLayers(mxd, "", df) lyrList.append(lyrInsert) for lyr in lyrList: if lyr.supports("DATASOURCE"): #print lyr.dataSource if lyr.dataSource == r"Database Connections\GIS_USER2PGIS.sde\SDE.Streets\SDE.LISStreetSegment": lyr.replaceDataSource(r"Database Connections\Test_Carta_LIS.sde", "SDE_WORKSPACE", "Carta.LIS.StreetSegment") lyr.name = "Carta.LIS.StreetSegment"
... View more
08-20-2010
10:37 AM
|
0
|
0
|
11
|
POST
|
bposthumus: My output path contained all the correct and required slashes, sorry that I did not post it: tempWS = "E:\\FMP_Reports_Tool\\tempWS.mdb\\" _garret_: I originally had used the Value table method but it kept crashing so I switched to creating the string. I followed a number of your ideas, changing all my paths from \\ to /, and using the os.path.join (tempws, tableName)... which didn't work either! Just in a round about sort of trial and error, frustrating , smash my face on the keyboard, way, I started switching some of my inputs back to the way I had before I tried your methods... Some where in the middle it worked! So I have a bit of a spaghetti factory code, all mixed up using various different methods to create the out puts and it works and I don't want to touch a thing. So dirty it will stay. I am still not sure why it wouldn't work though I suspect it possibly could have been the cursor used to create the list or value table, holding a lock on the variable? I dont know. Any way thanks again everybody for the suggestions. Today I am a Happy Gisser!
... View more
08-19-2010
06:16 AM
|
0
|
0
|
11
|
POST
|
Hello again, colleagues, I have a problem executing gp.merge_management or gp.merge tool within a script. My script needs to merge a varying number of tables together. In this instance there are 7, though this number can and will change. In order to accomplish this I have used various different scripting techniques, all of which have failed. I feel like I am so close and it should work, but there is something fishy stopping it, that I just can�??t see. The error I continually get is: #ERROR 000582: Error occurred during execution. Error code: 000582: Error occurred during execution. Description: An error occurred during the tool's validation or execution. No specific messages were available. The validation process checks that a tool's set of parameter values are of the expected number, data type, and value. Solution: Check that a tool's required parameter values are specified and are the correct data type. If the parameters are entered correctly, it may be possible the execute routine for the tool is invalid. Have the developer of the custom tool check the Execute implementation. See: http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?tocVisable=1&ID=-1&TopicName=tool%20errors%20and%20warnings:576-600&pid=1 Please see my attached code: Stage2Tbl = r"E:\\FMP_Reports_Tool\\tempWS\\Stage2Tbl" try: mergeString = r"" for tbl in mlist: mergeString = mergeString + tempWS + tbl + ";" insertStr = mergeString.rstrip(";") gp.Merge_management(str(insertStr), Stage2Tbl, "") except: # Get the geoprocessing error messages msgs = gp.GetMessage(0) msgs += gp.GetMessages(2) # Return gp error messages for use with a script tool gp.AddError(msgs) # Print gp error messages for use in Python/PythonWin print msgs The variable mlist is a list that contains the output names of tables that were created into the temp workspace earlier in the script. This list is then used to select those same tables, and merge them back together. I create the mergeString variable from the mlist , to be used in the actual gp.merge tool. I was concerned that there may be a problem reading the workspace strings in the mergeString, so I added the �??r�?� to create a raw string. This had no effect. I read previously in another thread that I might need to convert my string, to string within the actual tool. I added this but had again the same result. I used my string variable insertStr in the merge tool of a separate script and it worked just fine! So it just will not work here. Please, are there any suggestions on anything further I should try or other methods which might work in this circumstance? I am using ArcInfo 9.3 and python 2.5 if that helps. Thanks! - James Ps. This is worth at least 3 Stars on the old forums...
... View more
08-18-2010
11:29 AM
|
0
|
6
|
1716
|
POST
|
I ran a test on that and it works like a charm! I tried to take it a step further though and I found that I can't use the getattr ( , ) function to allow the user to define what the input field name will be. InAge = gp.GetParameterAsText(0) OutField = gp.GetParameterAsText(1) rows = gp.UpdateCursor("c:\temp\test.dbf") row = rows.Next() while row: if getattr(row, InAge) == 25: getattr(row, OutField) = "Mid" #<-- DOES NOT WORK: RETURNS SYNTAX ERROR AT THIS LINE #row.Range = "Mid" "ERROR: Failed to check - syntax error - can't assign to function call (test.py, line 23)" I guess the reason it fails is this: In the if line " if getattr(row, InAge) == 25:" we are assigning a user value to the variable then asking IF it equals 25, do the following: Then in the following, we assigning another user value to the variable to be the FieldName, but then immediately trying to re-assign a new value, changing the FieldName, to the input value for that field. Then python gets confused and screwy. Unless there is some kind of list or tuple or something that would allow the storage of more than one value in the attribute to be used in this circumstance, I don't know if it would ever work... Thanks jscheirer, - James
... View more
08-10-2010
03:57 AM
|
0
|
0
|
2
|
POST
|
Hello, I would like to create tool for multiple users with multiple datasets from multiple sources. Each dataset contains the same data, it's just stored differently, mostly just different field names and input locations etc... Is it possible to insert a variable into an Update Cursor to give the tool more flexibility with multiple users? For example: InAge = sys.argv[1] rows = gp.UpdateCursor("c:\temp\test.dbf") row = rows.Next() while row: if row.InAge == 25: row.Range = "Mid" Will InAge work as a variable? Or will the cursor look for a field called "InAge" ? Is this even possible ? Thanks!
... View more
08-09-2010
01:41 PM
|
0
|
5
|
783
|
POST
|
If you have an ArcInfo License, you could use the Identity Tool From the Analysis Tool Box? http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=Identity%20(Analysis )
... View more
08-09-2010
01:26 PM
|
0
|
0
|
3
|
POST
|
In the event that you don't have ArcGIS 10.0, I have your code + tool bar tool I promised. I asked a friend if he would help me in figuring out some code, and he just created it for me so it all works out in the end! Attached is a .zip file called "JIMCODE"... Inside there is a file JIM.mxd. Open the .mxd. Load your backwards Polygon file. Go to the toolbox / Samples / Conversion / Data management / Write Features to Data File tool. Input your polygon and save the text to your workspace. THEN, click on the JIM tool at the bottom of your standard ESRI toolbar... (Thats why you had to load this mxd, because I don't know how to make it a free standing tool. My friend did all the work) Using the JIM tool, input your newly created txt file, and the tool will output an output text file into the same workspace directory. Finally, go back to the toolbox, and use the reverse tool : "create features from text file" and select the newly created text file. I don't know how to load the JIM Tool into a model, but if you could, that would be the slickest coordinate switcher ever. Also, I apologize that every thing is named JIM, I should have specified to my friend, what we were doing with this thing... plus I never asked him to write it but since I don't know VBA, I couldn't say no after the fact. So now you have lots of help. Hopefully one of them works! Let us know! - JIM
... View more
08-05-2010
03:38 PM
|
0
|
0
|
67
|
POST
|
Apparently the vertices of a polygon can be read ad outputted to a .txt file. using the: Samples / Conversion / Data management / Write Features to Data File tool. The reverse can be done here too. See: create feature from text file. http://forums.esri.com/Thread.asp?c=93&f=992&t=301240 So In theory a script could be written to read the poly, Output the txt file, perform the math (+100000x, -100000y) , and then rewrite polygon with .txt file. I'll see if I can slap a sample together for you.
... View more
07-30-2010
05:05 AM
|
0
|
0
|
67
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|