|
POST
|
Thanks Josh and George. I am trying to automate several different tasks and the reason I was trying to determine the geometries of the feature classes is to run a different scenario depending on the type of geometry exists. I haven't worked with sde databases much and I have automated several tasks in the past before but not to this degree. Also, I have a mixture of feature classes where the feature classes exist both in a database and dataset. I tried researching different options to extract the names of the feature classes but for some reason I get either a partial name or a partial path. Is there a way to specifically get the name of the feature class given the full path of the feature class. Robert
... View more
10-02-2019
07:21 AM
|
0
|
2
|
4475
|
|
POST
|
Hi, So I am working on a script to automate a process for populating certain fields in several feature classes, but in order to do so I need to determine what kind of geometries these feature classes are. Depending on what kind of feature classes they are, the script runs a certain way. The issue I am having with the script is I am not getting the list of geometries for the feature classes. The feature classes are in sde (not sure if that makes a difference) and I keep getting a list, but not a list of the geometries. Any help would be greatly appreciated. import arcpy
arcpy.env.workspace = r'Database Connections\Storm Water.sde\STORM.GISADMIN.Storm_Network'
fcs = []
descList = []
fclist = arcpy.ListFeatureClasses()
for fc in fclist:
fcs.append(fc)
for fc in fcs:
desc = arcpy.Describe(fc)
descList.append(desc)
... View more
10-01-2019
07:03 AM
|
0
|
17
|
6322
|
|
POST
|
Thanks again Curtis for the help. I do recall using something similar when I was taught how to use windows task scheduler to automate the scripts executions, but never thought to use command line for that. I never tried specifying how python should run, whether as 32 or 64 bit, but it is good to know that you can actually specify how it should run.
... View more
09-27-2019
04:29 AM
|
0
|
0
|
1868
|
|
POST
|
I could probably change the names of the feature classes in the table. I thought about working on a script that would pull out only the names of the needed feature classes. The issue I ran into is how to set up the output parameters so that the user could simple select from the list rather than having it scripted. I don't quite know how to set that up, but I am familiar with the set parameter and/or the set parameter as text options. I may look into that further after I manage to get this script up and running.
... View more
09-26-2019
11:47 AM
|
0
|
0
|
1544
|
|
POST
|
They have similar characters, but the names in the table are spelled out for the most part where the feature class names are conjunctions. Here is the list of the feature class names. swPipeEnd swStream swSplwy swOutCtrlStr swOpnCnd swManhole swJunctBox swIntersection swInlet swHeadwall swClsdCnd swBridge swAssumedStructure
... View more
09-26-2019
11:41 AM
|
0
|
0
|
1544
|
|
POST
|
Hi, So I have a relatively simple script that is basically a complete list of feature classes in a database and I was wondering how you would compare that list of feature classes to the list of records in a table. The other thing is, if there is a match between the list of feature classes and the table, to have the table populate with the record count of the matching feature class. I have a rough script that has both the list of the feature classes in a database and the list from the table, as well as the counts for each feature class. The other issue is that the names aren't the exact same but are similar. So I am trying to first figure out how to compare the list of feature classes to the list of records in the table. I think once I can get that then the rest should be relatively simple to do. import arcpy
#set parameters
inputTable = r'G:\MyThings\Test\NewTest3\StormLoad.gdb\Stormload_Table'#arcpy.GetParameterAsText(0)
select_databases = r'G:\MyThings\Test\NewTest4\StormLoad.gdb'#arcpy.GetParamterAsText(1)
#select_fields_toUpdate = arcpy.GetParameterAsText(2)
input_value = '2'#arcpy.GetParameterAsText(3)
arcpy.env.workspace = select_databases
#Get list of field names
field_names = [f.name for f in arcpy.ListFields(inputTable)]
#Identify feature class and database field name
fcdb_name_field = field_names[1]
#Select the field names to populate
select_field_names = field_names[2:]
datasetList = arcpy.ListDatasets('*','Feature')
#List feature classes
def fcsInDS():
for dataset in datasetList:
arcpy.env.workspace = dataset
fcList = arcpy.ListFeatureClasses()
return fcList
fcsInDB = arcpy.ListFeatureClasses()
fcs = fcsInDS() + fcsInDB
for fc in fcs:
fc_ReCount = arcpy.GetCount_management(fc)
print '{0} has a record count of {1}'.format(fc, fc_ReCount)
with arcpy.da.UpdateCursor(inputTable, field_names) as cursor:
for row in cursor:
if row[1] in fc:
row[2] = input_value #
cursor.updateRow(row) I also noticed that when it loops through the list of combined lists, that it errors out with the feature classes in the database as either non existent or supported. I tried making a couple of adjustments to this script but it returns errors. I would greatly appreciate any assistance with this. -Robert
... View more
09-26-2019
08:32 AM
|
0
|
3
|
1607
|
|
POST
|
Thanks Curtis, I didn't know there was a difference depending on how the script is run. It's good to know that depending on where I plan on running the script.
... View more
09-26-2019
06:32 AM
|
0
|
2
|
1868
|
|
POST
|
Good afternoon, So I am currently working on a script tool where I have to populate a set of records in a standalone table to feature counts for feature classes found in various databases. The issue that I have come across as of now if how to determine if a set of strings is similar, and if they are, run a loop to get a feature counts to then populate that record. This is nested in anther loop that loops through every field name in a standalone table. I also have fields where the name of the field corresponds with the name of the database it is derived from, and I have another loop that goes through each field name. So I am at a crossroad where I have a possible solution, but not sure if this is the right direction. Any assistance would be greatly appreciated.
... View more
09-23-2019
12:38 PM
|
0
|
0
|
766
|
|
POST
|
Thanks Curtis for the links. I have nested models within models before, but the issue I am facing currently is that I have multiple feature classes with these databases that I need to get counts for(which a simple select data and get count models could take care of). The issue I come across every time the model that I currently have runs, it will run through either one iteration process or the other fully, and not returning with the end result that I am looking to achieve. I am not sure if it is the way that the model is nesting or if it is the order in which it is nested. So here are the cases for each instance where I am having issues: Iterate selected rows --> iterate multivalue(nested) --> select data (some feature class)(nested) --> Get Count(nested) --> Calculate Field(nested) Iterate multivalue --> iterate selected rows(nested) --> select data(some feature class)(nested) -->Get count(nested) -->Calculate Field(nested) I have tried both and I am not sure if it is due to the way they are nested, or the order in which they run. I will keep trying, but perhaps it might be due to how they are nested which is causing one to run fully and.then the other. I will keep trying to see and testing each design. The other option I am looking at is creating a script tool, which will be cleaner and more flexible. The databases in which this model is working with are personal databases, which arcpy doesn't recognize as well as it does file geodatabases. I figured out that despite this limitation, creating a script tool to run in process using modelbuilder seems to work with personal geodatabses. Any help on this too I would greatly appreciate. Thanks, Robert
... View more
09-22-2019
05:03 PM
|
0
|
4
|
1868
|
|
POST
|
Thanks Dan, I don't plan on sticking to just one language. I know some other languages that , not sure if they are script or code languages, are still useful. The other type of languages that I also use is html/css. I do want to learn java/javascript because I would like to be able to create custom tools for the arcgis online environment. I believe I can still accomplish that with python, but it still wouldn't hurt to simply know other languages, especially when it comes to security. I have yet to try jupyter notebook, and I don't know if the script process is similar or if it varies a good bit. I have heard of pycharm but never actually used it, and I don't know if it behaves the same way as the python gui for arc. I am slowly getting comfortable enough that I can create simple tools here and there, but I plan on challenging myself more by creating more complex scripts and tools. Also, when it comes to scripting (either for arcigs ,pro, or any other applications) is it best to keep the scripts short, simple, and variable, or is it better to create large somewhat and complex scripts the may only provide a single use or slightly variable use. That is the other thing that I am not quite sure about is I thought that the more variable a tool is, the easier it is to utilize it for other various purposes. but there is so much more to learn, and I am always open for trying something new (especially challenging things) because that broadens horizons more. I greatly appreciate the feedback and I will keep learning and practicing while incorporating new things along the way. -Robert
... View more
09-19-2019
06:55 AM
|
0
|
0
|
1395
|
|
POST
|
Thanks Henry, I will definitely take a look at those when I get the chance. I am still practicing python at work to see if I can script tools simple and straight forward enough that I can fill in the gaps where I find them. I will keep creating and modifying the scripts to see if the way that they were typed could be simplified so it will take less processing time. I really appreciate the pointers on where to learn and what to learn when it comes to python. I would also like to get good enough to where I can utilize the python library that Esri has built into python, things ranging from dialogue boxes to sending and receiving emails. Eventually I would like to automate as much as I humanly can, especially for tasks that consists of redundancy. -Robert
... View more
09-18-2019
04:17 PM
|
0
|
2
|
1395
|
|
POST
|
Thanks Henry, I was actually able to get the result that I was looking for through my coworker. He went in a different direction but the end result turned out to be what I was looking for(with some minor changes). I didn't consider using the f.split as an option and I think that might have made things a bit simpler for me. I am learning that with python that there simply isn't just one way to go about things, depending on direction and desired outcome. Thank you very much for that example. I will keep practicing using the examples provided as well as testing other options just to see what directions are possible.
... View more
09-18-2019
05:48 AM
|
0
|
0
|
1212
|
|
POST
|
Ok. I haven't tried adding a python addin tool to pro just yet since I would like to be able to create the kind of tools needed for both the model that I am working on as well as other things.
... View more
09-18-2019
05:39 AM
|
0
|
0
|
3476
|
|
POST
|
The other thing is that I would like to get to the point where I can script well enough in python to be able to fully utilize the python addin tool. I discovered this a year or to ago and I was really intrigued with how easy it was to create an addin tool simply using python. The other thing people have mentioned to me as well is the arcobjects for visual studio(which I would also like to learn eventually) simply because the idea of a greater level of flexibility would make simple or complex tasks seem seamless. So there is a lot that I would like to utilize, in addition to python, to further enhance my skill set. I am currently working on a complex 3D model using Microstation, CityEngine, and ArcPro. I would like to eventually create tools to go along with that model. I am still in the design phase but once everything is set up, I hope to eventually enhance the model further.
... View more
09-17-2019
07:56 PM
|
0
|
2
|
3476
|
|
POST
|
I came to that conclusion about a week ago when I was tasked with a simple assignment that, to my knowledge, they had been doing by hand for several years. I had done this task by hand just to learn the workflow and after a couple of times, I realized that this process could easily be rendered seamless if I could simply create something (either python script, modebuilder, or both) that would convert an elongated methodology and simplify it. The other thing is that I have been trying to get the scripts that I have created so far to work in process in modelbuilder. The reason being is that if either I or someone else wanted to use it, it wouldn't be confined to whatever parameters I set up in the script. For some projects that are like this, I have used models most of the time to simplify these tasks. But I realized that some of the tools I need to reach the end result that I wanted, didn't exist, or hadn't been created. So I came to the conclusion that learning python would help fill in the gaps where some of the tools weren't provided or created. But I also realized that some of the python processes I was lacking, and so I don't have quite a solid foundation on most of those. I understand basics like classes, modules, simple scripts, some loops(could probably use more practice with those) and many other things<---like 98.99% of those things My friend and I had practiced python before, and I even took a class on it. Unfortunately we were using the Esri python book, which made little to no sense, and lacked anything in terms of understanding the principles and such. I would like to eventually get to the point where I can I can comfortably create scripts that would get to the result(s) that I picture. So I will keep trying and practicing, and do my best to not get lost since I had little to no understanding on how much a person could really accomplish just using python alone. Thanks for your help Jeremy, and everyone who continues to give wisdom and guidance -Robert
... View more
09-17-2019
06:04 PM
|
0
|
4
|
3475
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a week ago | |
| 1 | 02-10-2026 06:09 AM | |
| 1 | 03-04-2026 01:08 PM | |
| 1 | 02-24-2026 12:59 PM | |
| 3 | 03-03-2026 10:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
Wednesday
|