|
POST
|
Today is not my day apparently. I am running this through IDLE/Command Prompt I keep getting a runtime error. This is the code I have for the UpdateCursor. Maybe something is wrong?? fc = "C:\MEWCo GIS System\Electric System\MEWCo_Electric_Model-LOCAL.gdb\Secondary\SERVICE_LOCATION"
fields = ["ACALARA_TYPE", "ACALARA_MODEL", "ACALARA_METER_TYPE"]
def proc(actype, acmodel):
# try except block handles non-handled cases!
try:
if actype == 75 and acmodel == 130:
result = "CEN3S4S20"
elif actype == 109 and acmodel == 2:
result = "UMT2.1"
else:
# we ran into an uncovered case
raise(Exception)
except:
raise ## remove this line after you get it working
result = "undefined"
return result
with arcpy.da.UpdateCursor(fc, fields) as rows:
for row in rows:
row[2] = proc(row[0], row[1])
rows.updateRow(row) Thank You
... View more
09-19-2016
02:41 PM
|
0
|
4
|
2419
|
|
POST
|
I know there is a way to run this process through Arcpy Update Cursor. However, I am not sure exactly how to start the code.
... View more
09-19-2016
11:46 AM
|
0
|
6
|
2419
|
|
POST
|
Curtis: Thank you for the reply and the script. I tried entering it into Calculate field through the FC Table. However, all of the fields in the ACALARA METER TYPE field got filled in with "undefined" from the last part of the script.
... View more
09-19-2016
11:36 AM
|
0
|
3
|
2419
|
|
POST
|
I have been looking around the internet all morning to figure out how to write a Python script to accomplish what I need to do, and so far, I am not finding what I need. Need to see if someone can start me in the correct direction. I have (2) text fields: ACALARA TYPE and ACALARA MODEL with coded meter type attributes Another field: ACALARA METER TYPE will hold the actual Meter Type The data in the first two fields is held in a different database and I have a Python script built that will take that data and update these Feature Class Fields. What I need to do is build a second python script that is composed of an if/else statement. EXAMPLE: If ACALARA TYPE = 75 and ACALARA MODEL = 130 Then the ACALARA METER TYPE field will update to show "CEN3S4S20" If ACALARA TYPE = 109 and ACALARA MODEL = 2 Then the ACALARA METER TYPE field will update to show "UMT2.1" There are around 2 dozen other combinations with additional Meter Type outputs that I will have to include Figuring out how to write this code will help with other Feature Classes that I have been updating manually. Thank You
... View more
09-19-2016
11:00 AM
|
0
|
12
|
4541
|
|
POST
|
Wanting to know how to print the value/attribute from a specific field within the GDB table to the Shell Window
... View more
08-08-2016
09:48 AM
|
0
|
1
|
3107
|
|
POST
|
All of these are really helpful. The only thing that I do not know how to do and not being answered is when the results are produced in the Geodatabase Table from the Summary Statistics tool into a specific field is how to tell the Python script to "print/report" the value in that field in the Python shell. I know it may not make sense why I am doing it that way, but for me it works. I want to use the Python scripts that I am designing to run outside of ArcGIS, so when the script is complete, the data/results display in the Python Shell window. Thank You
... View more
08-08-2016
09:35 AM
|
0
|
3
|
3107
|
|
POST
|
The way I have been doing it is export the data into an Excel file and then use the Sum tool in Excel and than manually convert it. I want to be able to have the ability to do this in Python. Right now, i am building it in IDLE and want the final result to show in the IDLE Shell. Not sure how I get the results that are populated in the Geodatabase table to "Print" to the shell.
... View more
08-05-2016
01:50 PM
|
0
|
0
|
3107
|
|
POST
|
I have a good idea on the SearchCursor and the Summary Statistics. Been able to get the sum total of all the lines and it automatically saves into a table. What I need to do is run this in IDLE and have the results from the field that shows the total, "Print" in the python Shell once the script is complete.
... View more
08-05-2016
01:39 PM
|
0
|
2
|
3107
|
|
POST
|
I have a feature class composed of Overhead and Underground Electric Conductor, along with a different feature class of main water lines. I am attempting to build a python script that I can use to add into a tool for a "One-Click Button" to calculate and display the TOTAL distance of all of the lines in and feature class. To start, I am looking for some direction on designing and writing the Python script that will do this and produce the results of the total distance of conductor, water line in feet and miles. Any help on what tools to use to give the results would be great. Thank You
... View more
08-05-2016
01:24 PM
|
0
|
9
|
5069
|
|
POST
|
Sounds good. I will mess around with some different workflows and see what works the best. Thank You
... View more
07-29-2016
10:08 AM
|
0
|
1
|
5170
|
|
POST
|
Dan: Thank you for that. I actually just found that after doing a google search. I'm still trying to learn the complex world of Python scripting and takings different bits of script and putting them together. The way the script is written is set to run in ArcMap or ArcCatalog. How would I modify the script to run specifically in IDLE since the script is designed to run from Arc Toolbox with the user adding in text parameters? There would be about (12) different file(s) that all would go into the same File Geodatabase and result in (12) new geodatabase tables.
... View more
07-29-2016
10:00 AM
|
0
|
3
|
5170
|
|
POST
|
I am currently running ArcGIS 10.2.2 and would like to run a script through IDLE. I have around (12) different .TXT files of parcel data that is produced on a weekly basis from the county GIS database and want to be able to import them into a File Geodatabase - geodatabase table. From there, I have a good understanding of what to do from there to incorporate any changes into my working datasets. Its the beginning part that I am having issues with. Instead of doing table by table by hand, would like a Python script to do this for me automatically.
... View more
07-29-2016
09:25 AM
|
0
|
5
|
5170
|
|
POST
|
I really have no idea what I am doing wrong. I can create a Data Model in ArcMap/ArcCatalog and run the TableToTable tool to import a .CSV file into an existing File Geodatabase without any problems. However, when I run the same tool in a Python Script, it comes back saying the file (.CSV) is not supported. According the ArcMap 10.2 help, a .TXT and .CSV file format is supported. Is there another module that I am not importing? What piece am I missing here? I am want to build a tool that will import a bunch of .CSV file(s) into my working geodatabase on a as needed basis which will be used for other processes, but this first step is preventing future development. Thank You in advance
... View more
07-29-2016
08:35 AM
|
0
|
7
|
10360
|
|
POST
|
Are you able to design GUI applications with wxPython and use them in ArcReader? I know it is easily done for ArcGIS Desktop, but it would be more beneficial for my end-users to have them in ArcReader. To what level can a developer customize ArcReader (search toolbars)
... View more
07-19-2016
07:30 AM
|
0
|
0
|
1720
|
|
POST
|
This is kind of what I am looking for. However, when I open the Excel file, there are a number of fields included even though I selected only (1) field in the "Visible" column of the Make Feature Layer tool. Not sure why that is? I have around 20 fields and only need to export the attributes selected from (1) of those fields. Basically, I am saying find all of the attributes from the CIRCUIT_ID field that match "F-1 Feeder" and export the attributes under the TWACs_NUMBER field and only export the TWACs_NUMBER field. Somehow, it is not working exactly that way. Am I missing something or is there a setting wrong on my part? So far, you seem to be on the right track but I must be doing something wrong.
... View more
12-03-2015
10:19 AM
|
0
|
1
|
3936
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-23-2026 10:58 AM | |
| 1 | 11-20-2025 02:52 PM | |
| 1 | 10-30-2025 12:42 PM | |
| 1 | 10-16-2025 10:51 AM | |
| 1 | 08-27-2025 08:47 AM |
| Online Status |
Offline
|
| Date Last Visited |
4 hours ago
|