|
POST
|
I have some what of a solution starting at line 9 - 12 but the problem is that i am not sure how to do more than just one at a time. currently the following just does 'N ', i need it to do 'N ','S ','E ','W '. How can accomplish this? '''
prefixes = ('N ','S ','E ','W ')
with arcpy.da.UpdateCursor(lyr, 'STREET') as cursor:
for street, in cursor:
if street and street.lstrip(prefixes):
cursor.updateRow()
'''
field = 'STREET'
for field in [f.name for f in arcpy.Describe(lyr).fields if f.type == "String"]:
exp = "!{0}!.strip('N ')"
arcpy.management.CalculateField(lyr, field, exp.format(field), "PYTHON")
... View more
04-24-2018
09:33 AM
|
0
|
0
|
2601
|
|
POST
|
I couldn't get it to work like you posted. I had to move the whereclause out of the UpdateCursor. where = "STREET LIKE 'Xit%' OR STREET LIKE 'Uprr%' OR STREET LIKE 'Inpr%' OR STREET LIKE 'Impr%' OR STREET LIKE 'Rxr%' OR STREET LIKE 'I 84%'OR STREET LIKE 'Hwy%'"
with arcpy.da.UpdateCursor(lyr, 'STREET', where) as cursor:
for row in cursor:
cursor.deleteRow()
... View more
04-24-2018
08:24 AM
|
0
|
0
|
2441
|
|
POST
|
I figured out why some of the attributes did not have the first letter capitalized.
... View more
04-24-2018
08:23 AM
|
0
|
0
|
2441
|
|
POST
|
Not sure but it's not working, i don't get any errors. It doesn't remove any of these.
... View more
04-24-2018
07:47 AM
|
0
|
0
|
2441
|
|
POST
|
I need to remove just the pre-directionals and keep the name. Thanks. E El Jay Ct --> El Jay Ct E Elgin St --> Elgin St E Elk River St --> Elk River St
... View more
04-23-2018
09:18 AM
|
0
|
0
|
2601
|
|
POST
|
So after a closer look it seems as this is remove a lot of street names what begin with 'N ','S ','E ','W ' not just the pre directionals. Any ideas?
... View more
04-20-2018
11:37 AM
|
0
|
2
|
2601
|
|
POST
|
why do you guys have row0 = "I 84 Exit 21" and 'Inpr Mp'shouldn't it row0 = "STREET"?
... View more
04-20-2018
10:05 AM
|
0
|
1
|
2441
|
|
POST
|
I have some rows that i would like to remove if they start with certain letters. I have the following code but i have to run it twice in order for it to remove certain rows, i am not sure why? I want to be able to remove rows that have the following in them "Xit",UPRR""Inpr Mp", "Impr Rxr", "I 84". How can i do this? #delete all attributes/Rows that start with Xit, UPRR,Inpr Mp, Impr Rxr, I 84
with arcpy.da.UpdateCursor(lyr, 'STREET') as cursor:
for row in cursor:
if row[0].startswith("Xit"): #"UPRR","Inpr Mp", "Impr, "Rxr", "I 84"
cursor.deleteRow()
... View more
04-20-2018
09:13 AM
|
0
|
9
|
2584
|
|
POST
|
It seemed at it kind of worked. I noticed that every street with capital letter in the begging of the name was sorted correctly but towards the bottom the streets that don't have the first letter capitalized get sorted starts over after streets with a capital "Z".
... View more
04-12-2018
08:33 AM
|
0
|
1
|
1950
|
|
POST
|
I have a table that i am trying to remove just the street predirectional's of the table. I have the following code but it removes more than just the predirectional's from the street name. For example N St Alphonusu Way to turn into T Alphonsus Way. I just want to remove the "N", "E", "W" & "S" from the street name. How can do this correctly? lyr = "C:\Temp\Default.gdb\CurrntRoadNamesTableTest_1"
for field in arcpy.ListFields(lyr, "*", "String"):
with arcpy.da.UpdateCursor(lyr, ['STREET']) as cursor:
for row in cursor:
s = row[0]
row[0] = s.lstrip('W ')
a = row[0]
row[0] = a.lstrip('E ')
b = row[0]
row[0] = b.lstrip('N ')
X = row[0]
row[0] = X.lstrip('S ')
cursor.updateRow(row)
del cursor
... View more
04-12-2018
08:08 AM
|
0
|
7
|
2703
|
|
POST
|
ok, i wasn't sure why it's not getting sorted. I thought maybe it was because of that but it's not the case because nothing is getting sorted.
... View more
04-11-2018
03:02 PM
|
0
|
0
|
1950
|
|
POST
|
Could it be because some street name fist letter is not capitalized?
... View more
04-11-2018
01:39 PM
|
0
|
2
|
1950
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-27-2022 11:37 AM | |
| 1 | 10-31-2023 10:16 AM | |
| 1 | 02-16-2023 01:50 PM | |
| 1 | 08-11-2021 11:13 AM | |
| 1 | 01-06-2021 10:45 AM |
| Online Status |
Offline
|
| Date Last Visited |
09-10-2024
10:42 AM
|