|
POST
|
I wasn't playing the comma correctly in "TAX " + ", TAX ". I had it "TAX " +, " TAX ", thanks. Although it put "TAX" in every row even one's that didn't have any tax numbers i just another udpatecursor to remove all the extra values with just "TAX".
... View more
10-04-2019
11:07 AM
|
0
|
0
|
826
|
|
POST
|
OK, i wasn't sure what you meant by that. One more question if you don't mind. How can i add 'TAX' to the out puts based on your code? With the following i get '30-A-1-D', '30-A-1-D-A', '30-A-1-F' with arcpy.da.UpdateCursor(recs,['Legal','Legal2']) as cursor:
for row in cursor:
row[1] = ','.join(extract_tax_ids(pattern.split(row[0].upper()))).strip()
cursor.updateRow(row) I want to get TAX 30-A-1-D, TAX-A-1-D-A, TAX-30-A-1-F, etc.
... View more
10-03-2019
11:57 AM
|
0
|
2
|
826
|
|
POST
|
Joshua i think you are right there might be some case that i'll have to manually address. question if you don't mind, based on your code you mentioned that i wouldn't be able to pass a list of values directly into a single field with the update cursor do you mind sharing how i can do this please?
... View more
10-02-2019
08:31 AM
|
0
|
4
|
826
|
|
POST
|
The code worked but i think the data in the legal field has lots of variations and i thought that the tax number ended before an alpha number but it doesn't, some will be TAX 30-A-1-E or TX 30-A-1, etc. 27-4N-3W SW BEALS ACREAGE E 278' OF TX 30-A OF BLKS 3,4,5,6 LESS TX 30-A-1 LS ST
22-4N-3W NE DEMENT TAX 7-B BLK 52 IN DEMENT & BOONE CALD
27-4N-3W SW BEALS ACREAGE TAX 14-B IN BLK 4 LESS TAX 14-B-1
27-4N-3W SW BEALS ACREAGE TAX 20, TAX 30-A-1-E BLK 3
27-4N-3W SW BEALS ACREAGE TX 30-A-1-D-A BLK 6
24-4N-5W NE TAX 2&3 IN NENE
31-4N-2W SW LONGVIEW PLACE TX 1 IN BLKS 1,2,3,LS HWY,, TX 4,5 IN BLK 3 & TX 9,10 IN BLK 4 TX 8 IN BLK 6
24-3N-2W NW NESW LESS TAX 34 & 46, S 1/2 NW LS TX 67 IN SWNW,,TX 46-A IN NESW
21-4N-3W NE CALLOWAY ADD TX 4 & 5 & W 7' OF S 114' OF TX 3 IN LT 3 LS HWY BLK 2
1. should be TX 30-A, TX 30-A-1 2. should be TAX 7-B 3. Should be TAX14-B, TAX 14-B-1 4. Should be TAX 20, TAX 30-A-1-E 5. Should be TX 30-A-1-D-A 6. Should be TAX 2, TAX3 or TAX 2&3 7. TX1, TX 4&5, TX9&10 8. TAX 34 &46. TX 46-A or TAX34, TAX46, TX 46-A 9. Should be TX 4&5, TX 3 or TX 4, TX 5, TX 3 Running a print i get the following. 20', '30-A-1-E']
['43']
['33', '4', '17', '30-A-1-B']
['4', '33', '30-A-1-A']
['18', '30A1CC']
['30-A-1-F']
['30-A-1-D', '30-A-1-D-A', '30-A-1-F']
['30-A-1-C-A']
['30-A-1-C-B']
['7', '7A', '7B', '7C']
... View more
10-01-2019
02:22 PM
|
0
|
6
|
3229
|
|
POST
|
Some times it' not before the IN, some times it's before other alpha characters. It does appear to before alpha characters though. 22-3N-2W SE NAMPA ORIGINAL TX 98728 OF LT 32 BLK 34
02-3N-2W NW TX 03475 LS RD IN S 1/2 NW
... View more
09-30-2019
02:01 PM
|
0
|
8
|
3229
|
|
POST
|
I was able to get the print outs. I still need to get the Legal2 field populated with the results some how. When i add an update cursor i get the following error line 27, in <module>
with arcpy.da.UpdateCursor(recs,["Legal2"]) as cursor:
RuntimeError: 'in_table' is not a table or a featureclass I am a little lost on how to populate the Legal2 field? - with arcpy.da.UpdateCursor(recs,["Legal2"]) as cursor: with arcpy.da.UpdateCursor(recs,["Legal2"]) as cursor: for row in cursor: print results, but they looked like this. ['02362']
['03315', '05857', '05858']
['15022']
['03398']
['5858']
['05857']
['1', '2', 'T72007']
['1']
['2']
[]
[]
[]
[]
[]
['04089']
['04089'] currently have import arcpy, re
recs = r'C:\Temp\Descriptions.shp'
field = 'Legal'
recs = (row[0] for row in arcpy.da.SearchCursor(recs, field))
pattern = re.compile(r"[ ,&]+")
def extract_tax_ids(split_desc):
l = []
b = False
for i in split_desc:
if i in ("TX", "TAX"):
b = True
continue
if b and not i.isalpha():
l.append(i)
else:
b = False
return l
#for rec in recs:
#where = extract_tax_ids(pattern.split(rec))
with arcpy.da.UpdateCursor(recs,["Legal2"]) as cursor:
for row in cursor:
... View more
09-30-2019
09:06 AM
|
0
|
1
|
3229
|
|
POST
|
I have a field with with descriptions and i need to extract the tax numbers from this field and put them into another field in the same layer. Some examples of what i need . 1. 12-5N-5W SW NW SW S & W OF CANAL,, TX 2 IN SWNW LS TX 2-A - I need to extract "TX 2" from this field 2. 23-3N-2W SW 4TH ST TOWNHOMES TX 11271 IN LT 4C BLK 1 - I need to extract "TX 11271" from this row 3. 04-5N-5W SE TAX 3 & TAX 4 IN NWSE - I need to extract "TAX 3, TAX 4" from this row 4. 21-4N-3W SW TX 86, 89, 90 & 93 IN S 1/2 OF SW - I need to exact "TX 86, 89,90 & 93" from this row I currently can extract numbers with the following and i need help to include what i mentioned above. I guess i need to extract everything beginning at TX and before the space before the next alpha characters. fc = r'C:\Temp\Parcels.shp'
with arcpy.da.UpdateCursor(fc,['Legal','Legal2']) as cursor:
for row in cursor:
row[1] = ''.join([str(i) for i in row[0] if i.isdigit()])
cursor.updateRow(row)
... View more
09-27-2019
03:14 PM
|
0
|
14
|
4374
|
|
POST
|
Looking at my data i noticed that the OID@ on both layers where not matching so i had to change the OID@, my apologies. Once i changed the uniqueID and ran the script i get error. line 18, in <module> if [row[1]].strip().lower() != addDict[row[0]].strip().lower(): #if the value associated with those ids do not match AttributeError: 'list' object has no attribute 'strip' code import arcpy
from datetime import datetime as d
startTime = d.now()
fc1 = r'C:\Temp\TaxParcels1.shp'
fc2 = r'C:\Temp\AddresPointsTest.shp'
#build a dictionary of OBJECTID : Address pairs, change OID@ to your uniqueID
addDict = {row[0]:row[1] for row in arcpy.da.SearchCursor(fc1, ['ACCOUNT','SiteAddress'])}
#search through fc2 to see if addresses match based on OBJECTID value
#again, change OID@ to your uniqueID
with arcpy.da.UpdateCursor(fc2, ['Account','SiteAddres','Verifi2']) as cursor:
for row in cursor:
if row[0] in addDict:
if row[1].strip().lower() != addDict[row[0]].strip().lower(): #if the value associated with those ids do not match
row[2] = 'No'
else:
row[2] = 'Match'
cursor.updateRow(row)
del cursor
try:
print '(Elapsed time: ' + str(d.now() - startTime)[:-3] + ')'
except Exception, e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "Line %i" % tb.tb_lineno
print e.message
... View more
10-05-2017
01:22 PM
|
0
|
2
|
684
|
|
POST
|
tired the following but i get following error: if row[1].strip().lower() != addDict[row[0].strip().lower()]: #if the value associated with those ids do not match AttributeError: 'int' object has no attribute 'strip' if row[1].lower() != addDict[row[0].lower()]: & if row[1].strip().lower() != addDict[row[0].strip().lower()]:
... View more
10-05-2017
07:56 AM
|
0
|
2
|
2087
|
|
POST
|
I tried your suggestion to put it into a script but i still just get "No" for all the features. Would it have to do with the fact that the taxparcels address filed are all upper case letters and the points address field are all lower case?
... View more
10-04-2017
01:56 PM
|
0
|
4
|
2087
|
|
POST
|
Hi Mitch. thank you for the reply and help. I tried the code but i am getting the same results as before. I select the points in Arcmap and run the code in ArcMap python window. All of the point features have 'No' in the Verifi2 filed. on line 12 of your code should it be if row[1] != addDict[row[1]] since your comparing the SiteAddress and SiteAddres fields? Here is the code i am working with. import arcpy
from datetime import datetime as d
startTime = d.now()
fc1 = "AddresPointsTest"
fc2 = "TaxParcels1"
#set up cursors
cursor1 = arcpy.da.SearchCursor(fc1, ["SiteAddres", "Verifi2"])
cursor2 = arcpy.da.SearchCursor(fc2, ["SiteAddress"])
#build a dictionary of OBJECTID : Address pairs, change OID@ to your uniqueID
#addDict is for the taxparcels
addDict = {row[0]:row[1] for row in arcpy.da.SearchCursor(fc2, ['OID@','SiteAddress'])}
#search through fc2 to see if addresses match based on OBJECTID value
#again, change OID@ to your uniqueID
#UpdateCursor is for the address points
with arcpy.da.UpdateCursor(fc1, ['OID@','SiteAddres','Verifi2']) as cursor:
for row in cursor:
if row[0] in addDict:
if row[1] != addDict[row[0]]: #if the value associated with those ids do not match
row[2] = 'No'
else:
row[2] = 'Match'
cursor.updateRow(row)
del cursor
try:
print '(Elapsed time: ' + str(d.now() - startTime)[:-3] + ')'
except Exception, e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "Line %i" % tb.tb_lineno
print e.message
... View more
10-04-2017
08:15 AM
|
0
|
6
|
2087
|
|
POST
|
Yes they do have a unique ID that links them together. I guess i didn't think this through all the way...hummm So some parcels have an address point (separate layer) but some address points don't match the parcels(separate layer) site addresses i need to find the ones that match and don't match, but only of the selected features in ArcMap.
... View more
10-03-2017
01:49 PM
|
0
|
11
|
2087
|
|
POST
|
I am trying to update the points selected features field "Verifi2" with "Match" or "No" based on if the 'SiteAddres' field of the selected feature matches the parcels layer 'SiteAddress' field. I currently have the following code but all of the selected features have "No" in the Verifi2 field. Which is not the case because some of the selected point features SiteAddres does match parcels SiteAddress. I would appreciate some help please. import arcpy
from datetime import datetime as d
startTime = d.now()
fc1 = "AddresPointsTest"
fc2 = "TaxParcels1"
#set up cursors
cursor1 = arcpy.da.SearchCursor(fc1, ["SiteAddres", "Verifi2"])
cursor2 = arcpy.da.SearchCursor(fc2, ["SiteAddress"])
with arcpy.da.UpdateCursor(fc1, ["SiteAddres", "Verifi2"]) as cursor1:
for row1 in cursor1:
with arcpy.da.SearchCursor(fc2, ["SiteAddress"]) as cursor2:
row2 = cursor2.next()
#print row2
row1[1] = "Match" if row1[0].lower() == row2[0].lower() else "No"
#print row1[2]
cursor1.updateRow(row1)
try:
print '(Elapsed time: ' + str(d.now() - startTime)[:-3] + ')'
except Exception, e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "Line %i" % tb.tb_lineno
print e.message
... View more
10-03-2017
08:18 AM
|
0
|
14
|
3169
|
|
POST
|
It was my pc, i restarted my pc and recreated the file geodatabase and ran the script and it did what it was suppose to do. Sorry about that and thanks for the help!
... View more
10-18-2016
02:39 PM
|
0
|
0
|
1414
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-01-2024 07:19 AM | |
| 1 | 07-26-2024 09:38 AM | |
| 1 | 01-08-2024 09:44 AM | |
| 1 | 03-07-2023 11:46 AM | |
| 1 | 11-02-2020 08:24 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-14-2025
07:49 AM
|