POST
|
Doh! I looked into your suggest to parse that into a def but was not successful at all. I appreciate the help. Thanks.
... View more
08-22-2016
01:24 PM
|
0
|
0
|
116
|
POST
|
Has there been any advancements to this error? I am attempting to use the script but am coming back with the same error as Vaibhav. I have changed the SpatialReference to my data.
... View more
02-20-2019
03:10 PM
|
0
|
0
|
1506
|
POST
|
there is something wrong with the example you gave me, since it shouldn't be splitting things out letter by letter. it should just split on "\\" You had better do a test on that to see if it works with your inputs I would convert fullpath to a string first, then post that example since there is something amiss in my examples and your inputs.
... View more
07-21-2016
03:42 PM
|
0
|
0
|
182
|
POST
|
Elizabeth, I wasn't exactly sure of your environment/set-up, so I just wrote a PowerShell script, which can be executed outside of ArcGIS. It should be installed by default on Windows 7+. The script I wrote uses PowerShell 4, but the only change for PowerShell 2 should be the commented out line exporting to CSV, I believe. You would basically need to export your table as a CSV, open notepad, paste the script and make any needed enviro changes, save as a .ps1, then run the script (here's an example of how to do that - windows - How to run a PowerShell script? - Stack Overflow). Wes has a Python script you can just run in ArcMap that does exactly what you want, that is, check if the path on disk doesn't exist. I would need to adjust the PowerShell script to check for paths since I thought you were looking for web hyperlinks.
... View more
07-14-2016
11:59 AM
|
1
|
0
|
388
|
POST
|
I have made it work!!!!!! Code I used: # Populate SUBJECT_AREA only if there is a Rank shown in MAX_RANK field. expression = "LookUp(!MAX_RANK!, !Shape_Area!)" codeblock = "def LookUp(MAX_RANK, Shape_Area):\n\ if MAX_RANK == 0:\n\ return 0\n\ else:\n\ return Shape_Area" gp.CalculateField_management(currentWorkspace + "/myDataset", "SUBJECT_AREA", expression, "PYTHON", codeblock)
... View more
07-01-2016
08:01 AM
|
1
|
0
|
1041
|
POST
|
In a nutshell, putting any extra UI functionality into an ArcGIS tool is an antipattern, as the tools are designed to be portable within ArcGIS and usable from stand-alone Python. If you have a workflow which necessitates user input, this is a natural place to break the workflow up into multiple tools. Before the input step, write your data and use that data as the input for the next tool, (Deciding to move forward is essentially the Yes/No dialog in your case). This increases modularity of your tools and ensures that they can be accessed arbitrarily from any view - ArcGIS Desktop, Server or from a Python command line. Right now you'll get errors if you try to run outside of desktop and your tool is not portable between 10.x and Pro. Breaking it up like that also has the added benefit of future-proofing the workflow - say somewhere down the line someone invents a process which removes the need for user input, you can simply string your modularized workflow together in a 'wrapper' style tool, rather than recoding the entire thing. Hope that helps move things along! Clinton
... View more
08-29-2016
04:36 PM
|
1
|
0
|
653
|
POST
|
The logic is simply formatting the query correctly to make the query work. using the AddFieldDelimiters ensures the field names gets the proper characters around them.whether it is a feature class from a file, personal, arcgis server geodatabase or a shapefile.
... View more
06-28-2016
05:44 AM
|
1
|
0
|
446
|
POST
|
Thanks again Dan. I don't know how often I'll be here - I'm not really working with ArcPy/Python as much as I'd like, rather, only use it for scripting/batch processing when I have something large to run (usu. raster analyses/models). Great to have this forum - and great to see you staying on top of it all for us!
... View more
06-22-2016
06:14 AM
|
1
|
0
|
735
|
POST
|
Sounds like you need Iterate Feature Classes—Help | ArcGIS for Desktop and Feature Class To Feature Class—Help | ArcGIS for Desktop unless you need to test if the field exists
... View more
06-16-2016
11:49 AM
|
0
|
0
|
216
|
POST
|
Thanks. I would have made the sniplet if the license they got for my ArcMap allowed it. And it would have made my life MUCH simpler. I'll now research the Append and get it to work. Thanks.
... View more
06-21-2016
06:22 AM
|
0
|
0
|
341
|
POST
|
How about wrapping the whole if/then in a try/except?... If something goes wrong, you can send yourself an email.
... View more
08-11-2020
09:57 AM
|
1
|
0
|
1719
|
POST
|
Yep. Using Python to get the list of tracts, then edit a template XML document and create all the XML documents for all the tracts, and then making the new feature classes for each of the tracts. Now it's 'merely a matter of programming!"
... View more
06-08-2016
02:26 PM
|
0
|
0
|
322
|
POST
|
You could create a dictionary and return the names. And a text element it would be a little extra work to keep up the list and either run the script or create an Addin TextElement—Help | ArcGIS for Desktop users= {'uname':'User Name','oname':'Other Name','yName':'Use Your Name'}
users[os.getenv('username')]
... View more
06-16-2016
11:27 AM
|
0
|
0
|
886
|
DOC
|
I want to add one more FieldCalulator option for when you want things to be a true null (edit...in the eyes of ArcGIS 10.x.x). In my case, I was not testing for Null, but wanted to use FieldCalculator to replace empty-ish fields. I knew about this doc and read thru is several times before I got the python version to work in FieldCalulator (the VB was easier). Just fyi: My delema was caused by me using using TableToExcel, editing sorting uneven columns, then ExcelToTable which caused my emtpy Excel fields to be empty (maybe ""), but not NULL. When ussing these columns in my script with "TableToDomain_management", when it hit one of these empty fields, I would get the error "The value being added to the CodedValueDomain already exists. [domain name: gmuStRag1submajoy, code name: ]". Many hours later, trying to figure out whay I screwed up in the program lead me to the issue with not having null in the fields, which the TableToDomain_management would ignore. FYI - if using interactive FieldCalculator for VB or PYTHON, quick trick, edit the table in ArcMap, select the records you need to assign null, calc the field = Null if using VB None if using PYTHON_93 ....no quotes of anything else...Figured out the None from the document above. so...thanks! # And for a python script.. expression_type="PYTHON_93" # Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script # The following inputs are layers or table views: "testingNull" arcpy.CalculateField_management(in_table="testingNull",field="submajor2",expression="None",expression_type="PYTHON_9.3",code_block="#") # Or... expression_type="VB" # Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script # The following inputs are layers or table views: "testingNull" arcpy.CalculateField_management(in_table="testingNull",field="submajor1",expression="NULL",expression_type="VB",code_block="#") # sorry....could find the advanced key to format it for python. This document was very helpful, but want to add this as a comment, for others that may run into this and need to calculate the value to Null. Curtis, feel free to snip anything out and add to the doc if you feel it helps....otherwise, hopefully this can help others at some point. I'm tagging my blog so maybe I can find it again. myBlog
... View more
06-14-2016
04:07 PM
|
0
|
0
|
2440
|
Title | Kudos | Posted |
---|---|---|
1 | 09-14-2015 01:29 PM | |
1 | 01-26-2016 10:18 AM | |
1 | 08-15-2015 04:07 PM | |
1 | 09-14-2015 01:33 PM | |
1 | 08-21-2015 07:00 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|