|
POST
|
I have a feature class with some fields that i would like to remove the numeric characters from but just the numbers and only from the fist 3 characters of the attribute i need to able to keep the # and numbers at the end. The fields look like this FireDist HighwayDist SchoolDist FireDist 699 HWY #4 763 School #132 710 Rural Fire 690 HWY #1 762 School #131 720 Rural Fire 693 HWY #2 770 School #139 NOT in First Dist 696 HWY #3 765 School #134 I am not sure who to use arcpy to only look at the first 3 characters and if they are numeric to strip them and to strip it from all 3 fields at once. I would be grateful for some help. Thanks.
... View more
05-04-2017
09:17 AM
|
0
|
3
|
1893
|
|
POST
|
sure here you go. As for why there are \ in the attribute fields is because some parcel can have more than one zoning zone and is why you would see AG\C1\M1. I couldn't use a dash ( - ) because some of our zones are CR-RR (CONDITIONAL REZONE - RURAL RESIDENTIAL) and RR(RURAL RESIDENTIAL) which are different. so if these two zoning zones were part of a parcel it would have shown as CR-RR-RR and would have been confusing.
... View more
05-01-2017
02:46 PM
|
0
|
1
|
2041
|
|
POST
|
looks like it kind of worked....? it removed some of the \ but not all. See attached pic with arcpy.da.UpdateCursor(ZT1, "ZONING_CODE") as cursor:
for row in cursor:
#print row
#if row[0] or len(row[0]) > 0:
if "\\\\" in row[0]: #if a double quote is in the string returned,
for row in cursor:
if row[0] or row[0] > 0:
val = row[0].replace("\\\\","\\") #replace that double quote with an empty string (removes it)
row[0]=val[1:-1]
cursor.updateRow(row)
del row
... View more
05-01-2017
01:59 PM
|
0
|
3
|
3079
|
|
POST
|
apologies for my slowness. I tried the following but got error on line 7. cursor.updateRow([row[0][1:-1]]) TypeError: 'NoneType' object has no attribute '__getitem__' ZT1 = "In_memory\ZoningTest1"
arcpy.MakeFeatureLayer_management("In_memory\ZoningTest", ZT1)
with arcpy.da.UpdateCursor(ZT1, "ZONING_CODE") as cursor:
for row in cursor:
print row
cursor.updateRow([row[0][1:-1]])
del row
with arcpy.da.UpdateCursor(ZT1, "ZONING_CODE") as cursor:
for row in cursor:
#print row
#if row[0] or len(row[0]) > 0:
if "\\\\" in row[0]: #if a double quote is in the string returned,
for row in cursor:
if row[0] or row[0] > 0:
row[0]=row[0].replace("\\\\","\\") #replace that double quote with an empty string (removes it)
cursor.updateRow(row)
del row
... View more
05-01-2017
11:44 AM
|
0
|
5
|
3079
|
|
POST
|
I was able to remove the double "\\" from within attributes . It didn't how ever remove the \ in the begging or the end. I would appreciate any help please. \R2\\M1\ ----> \R2\M1\ \M1\\M1\\C2\ -----> \M1\M1\C2\ \AG\\R2\\M1\\R2\ -----> \AG\R2\M1\R2\ Current Code with arcpy.da.UpdateCursor("In_memory\LayerTest", "ZONING_CODE") as cursor:
for row in cursor:
#print row
#if row[0] or len(row[0]) > 0:
if "\\\\" in row[0]: #if a double quote is in the string returned,
for row in cursor:
if row[0] or row[0] > 0:
row[0]=row[0].replace("\\\\","\\") #replace that double quote with an empty string (removes it)
cursor.updateRow(row)
del row
... View more
05-01-2017
11:00 AM
|
0
|
7
|
3079
|
|
POST
|
I put a print row in between lines 2 & 3. with arcpy.da.UpdateCursor(ZT1, "ZONING_CODE") as cursor:
for row in cursor:
print row
if '\\\\' in row[0]: #if a double quote is in the string returned,
row[0]=row[0].replace('\\\\','\\') #replace that double quote with an empty string (removes it)
cursor.updateRow(row)
del row I get alot of [u'\\AG\\'] [u'\\AG\\\\C1\\'] [u'\\R1\\'] [u'\\RR\\'] [u'\\AG\\\\RR\\'] [u'\\AG\\'] [u'\\AG\\\\RR\\'] [u'\\CR-M1\\'] Traceback (most recent call last): File "C:\GIS\Python\ParcelTool\SpatialJoinTest.py", line 4, in <module> if '\\\\' in row[0]: #if a double quote is in the string returned, TypeError: argument of type 'NoneType' is not iterable
... View more
04-28-2017
08:54 AM
|
0
|
0
|
3079
|
|
POST
|
do you mean an elif, i am not sure i am understand how to wrap another if around the row[0] with arcpy.da.UpdateCursor(ZT1, "ZONING_CODE") as cursor:
for row in cursor:
if '\\\\' in row[0]: #if a double quote is in the string returned,
if row[0] or len(row[0]) > 0:
row[0]=row[0].replace('\\\\','\\') #replace that double quote with an empty string (removes it)
cursor.updateRow(row)
... View more
04-28-2017
07:58 AM
|
0
|
0
|
3079
|
|
POST
|
I need to remove forward slashes from the attributes in a layer. I need to remove the first \ and last \ and replace the double \\ with just one \. I would appreciate any help. Thanks. Currently the attributes looks like this. \R2\\M1\ \M1\\M1\\C2\ \AG\\R2\\M1\\R2\ I need it to look like the following R2\M1 M1\M1\C2 AG\R2\M1\R2 I tried the following but got error "TypeError: argument of type 'NoneType' is not iterable" on line if '\\' if '\\' in row[0]: #if a double quote is in the string returned. with arcpy.da.UpdateCursor("In_memory\LayerTest", "ZONING_CODE") as cursor:
for row in cursor:
if '\\' in row[0]: #if a double quote is in the string returned,
row[0]=row[0].replace('\\','\\') #replace that double quote with an empty string (removes it)
cursor.updateRow(row)
del row
... View more
04-27-2017
03:02 PM
|
0
|
14
|
5601
|
|
POST
|
I didn't not complete the other outlined steps. I didn't because i am not sure where excellently i need to edit the Main Config.json file of the application or of WAB 2.4? I do not see anything "lef": 145 in my app Config.json file. I am using the launch pad theme. This is to move the second and third icons over Main config.json Change left to 145 and 235 to the second and third
... View more
04-19-2017
09:55 AM
|
0
|
2
|
3660
|
|
POST
|
Aww sweet tool it took the table and converted it correctly, it worked with space separating the degree! FID Shape Long Lat DDLat DDLon 0 Point -116 37.863 43 41.353 43.68922 -116.63105
... View more
04-18-2017
03:00 PM
|
0
|
0
|
1965
|
|
POST
|
So i was given a excel. xls table with Lat and Long of decimal degrees minutes and i need to import it into ArcMap. I am needing to convert them to decimal degrees in order to import it into ArcMap. How can i convert this table the entire table to decimal degrees. I tried using the Add XY Data but when i select the file nothing happens, do i also need to convert the table certain format before add it to arcmap? Can this be done through arcmap or field calculator? I would appreciate any help. The table is populated as following Long Lat -116 37.863 43 41.353
... View more
04-18-2017
02:36 PM
|
0
|
6
|
2357
|
|
POST
|
I am editing the \server\apps\6\jimu.js\css. Would it have something to do with the fact that two icons are not original WAB icons?
... View more
04-17-2017
08:06 AM
|
0
|
4
|
3660
|
| 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
|