POST
|
I am not sure where to post this question. So, please feel free to suggest a move if necessary. The Environment: We are on ArcMap 10.6.1 with a versioned Oracle SDE The problem: I have a polyline feature class that we have been asked to relate to a stand-alone invoice table. Each table has a feeder ID field with many records for each feeder id. So, each feature should be joined to all others with the same feeder ID. Also, the stand-alone table is read-only, as it is updated nightly by a batch job. I tried a many to many relationships with the Feeder IDs as keys so each row in the relationship table looks something like this: RID POLYLINE_FEEDERID INVOICE_FEEDERID 1 SS1 SS1 2 SS2 SS2 . This works fine until one deletes one of the polylines. Let's say you delete one with a feeder ID of SS2. Then the system deletes the row RDI = 2, breaking the relationship between all other records with a feeder of SS2! It would seem that my only option would be to relate each feature within a feeder ID to each invoice using global ID and invoice IDs as the keys. That way each time you delete a feature the system would only break the relationship for the deleted feature. Is there a better way to do this? It feels like this should be not quite this complex. Thansk!
... View more
2 weeks ago
|
0
|
1
|
49
|
POST
|
I did not. I ended up dropping the python wrapper and just running the SQL in pl/sql developer. If you get it working please post your solution
... View more
10-14-2020
06:07 PM
|
0
|
1
|
61
|
POST
|
But Dan still has a point. I always use raw encoding for paths. r 'c:\xxxx\xxxx\xxxx'
... View more
08-25-2020
01:01 PM
|
0
|
0
|
91
|
POST
|
I see that now -- I googled the Counter object right after reading your post. I am going to add it to my python toolbox.
... View more
08-18-2020
04:06 PM
|
0
|
0
|
64
|
POST
|
I added comments to the code above. I would get it into a python IDE and step through it with a debugger. Doing this when I am taking on something new speeds up my learning... it takes away the "back box" effect.
... View more
08-17-2020
03:16 PM
|
0
|
0
|
166
|
POST
|
You could use a search cursor to read in the ids and then an update cursor the write the count out the feature class. import arcpy fc_path = r 'C:\my_temp\junk3\geo\fgdb.gdb\wells' ids = [ ] with arcpy . da . SearchCursor ( fc_path , 'ID' ) as cursor : for row in cursor : ids . append ( row [ 0 ] ) # make empty dict ids_dict = { } # get a list of unique ids, e.g. remove duplicates, set does this # then just convert it back to a list uids = list ( set ( ids ) ) # for each uid make a dict item with the key the uid and an empty list as the value for uid in uids : ids_dict [ uid ] = [ ] # this is what sets you up for counting. it finds the matching well id keys # and adds the key to the list value so you get in the dict {'w1': [w1, w1, w1]} # then all you need to do count the length of the value list. for id in ids : ids_dict [ id ] = ids_dict [ id ] + [ id ] with arcpy . da . UpdateCursor ( fc_path , [ 'ID' , 'DUP' ] ) as cursor : for row in cursor : for k , v in ids_dict . items ( ) : if row [ 0 ] == k and v is not None : row [ 1 ] = len ( v ) ids_dict [ k ] = None cursor . updateRow ( row )
... View more
08-17-2020
10:36 AM
|
2
|
2
|
166
|
POST
|
I am not sure I understand your question. Maybe it would be helpful if we had a little more info... what format is your original data is in? e.g. csv, feature class in a fgdb, database... etc. what is your target format? e.g. feature class in a fgdb can you give us an overview of what you are trying to do? I would use an update cursor to write the info from the dictionary back to a feature class in a fgdb for sure.
... View more
08-14-2020
06:05 PM
|
0
|
4
|
166
|
POST
|
Creating a new network junction feature class in the Catalog tree—ArcMap | Documentation Does anyone know if this is possible with python? And if so is there any documentation on it? Thanks!
... View more
08-13-2020
02:45 PM
|
0
|
0
|
67
|
POST
|
You could use dictionaries to count the number of repeating ids. Maybe something like this... ids = [ 'D36528' , 'D36528' , 'D36528' , 'D36532' , 'D36532' , 'D36521' , 'D36522' , 'D36525' , 'D36525' , ] ids_dict = {} uids = list ( set (ids)) for uid in uids: ids_dict[uid] = [] for id in ids: ids_dict[id] = ids_dict[id] + [id] for k , v in ids_dict.items(): print '{k}, {n}' .format( k =k , n = len (v)) Output: D36532, 2 D36528, 3 D36521, 1 D36522, 1 D36525, 2
... View more
08-13-2020
02:35 PM
|
1
|
6
|
166
|
Online Status |
Offline
|
Date Last Visited |
a week ago
|