|
POST
|
Have you tried printing the query to verify the syntax? If so, what does it look like?
... View more
10-17-2017
10:24 AM
|
0
|
3
|
1852
|
|
POST
|
Thanks Dan! I need to somehow convert the first two columns of the array into integer types before converting to a table. If not, the output table has 'Double' type in the ID fields. Which is not ideal. So that's why I tried to specify a dtype. I guess I need to head to your blog and study arrays more. Thanks again!
... View more
10-12-2017
07:52 PM
|
0
|
1
|
1197
|
|
POST
|
Essentially, I need to get a Numpy array (rows = x, cols = 3) to a geodatabase table. What is happening is when I specify the dtype of the array to get the field names / types for the table, the array gets reshaped. Any ideas? #format array to create table from
#array of nearest values... reshaped to: rows=(inXY * toReturn), columns=3
formArray = numpy.array(listArray).reshape(-1,3)
dts = [('IN_OID', '<i4'),('NEAR_OID', '<i4'),('NEAR_DIST', '<f8')]
finalArray = numpy.rec.fromrecords(formArray, dtype = dts)
#export to geodatabase table
arcpy.da.NumPyArrayToTable(finalArray, r'...\ArcGIS\Default.gdb\out_table') How the array structure should look: How the array looks after specifying dtype And this is what the output table looks like (notice it has 60 rows... it should only contain 20)
... View more
10-12-2017
01:45 PM
|
0
|
3
|
1431
|
|
POST
|
You can generate a Near Table if you have an Advanced license.
... View more
10-11-2017
08:51 AM
|
0
|
0
|
669
|
|
POST
|
Layers can be accepted in a tool if the Data Type is set to "Feature Layer". Secondly, if you want to limit the input layer to some specific IDs, I would suggest using a SQL Expression parameter with the Data Type set to "SQL Expression". This can be set to 'Optional' and you can set "Obtained from" to your input feature layer. Just remember to incorporate this in the actual Python code.
... View more
10-06-2017
12:45 PM
|
1
|
3
|
2489
|
|
POST
|
if row[1].strip().lower() != addDict[row[0]].strip().lower()
... View more
10-05-2017
09:10 AM
|
0
|
1
|
2176
|
|
POST
|
Yes... the != operation is a strict comparison. I would include .strip() and .lower() for comparison.
... View more
10-05-2017
06:02 AM
|
0
|
3
|
2176
|
|
POST
|
A couple things... do not run this code in the Python executable window inside of ArcMap. Please make this tool a Script Tool. It will be much easier to manage and deploy. Secondly, no... the addDict[row[0]] is correct because you're asking Python to compare the value of the dictionary associated with that ID. Please research dictionaries and script tools. You may want to print the keys and values of the dictionary to make sure it's built properly.
... View more
10-04-2017
08:26 AM
|
0
|
5
|
2176
|
|
POST
|
If you make your Python script able to be consumed with ArcMap (via Script Tool), then it will automatically accept a selection. What you need to do is: 1.) Build a dictionary of ID: Address pairs 2.) Search feature attribute table for presence of Addresses 3.) Update field based on result from 2 This should get you started. fc1 = r'complete_path_to_featureClass1'
fc2 = r'complete_path_to_featureClass2'
#build a dictionary of OBJECTID : Address pairs, change OID@ to your uniqueID
addDict = {row[0]:row[1] for row in arcpy.da.SearchCursor(fc1, ['OID@','SiteAddress'])}
#search through fc2 to see if addresses match based on OBJECTID value
#again, change OID@ to your uniqueID
with arcpy.da.UpdateCursor(fc2, ['OID@','SiteAddress','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
... View more
10-03-2017
02:16 PM
|
1
|
10
|
2176
|
|
POST
|
Do these two datasets have a unique ID that links them together? If so, you could create a dictionary with ID: Address pairs and use that to search the attribute table. Nested cursors get tricky... Just to clarify, are you looking for any Addresses in FC1 that are not in FC2?
... View more
10-03-2017
11:44 AM
|
0
|
12
|
2176
|
|
POST
|
Another idea is memorialize the GlobalIDs in the Feature Class (create new field called [GBL_GUID], GUID type --> Field Calculate the [GBL_GUID] field to the values in GlobalID). Now, if you export any data from that Feature Class in whatever database format.. the relationship will be maintained through the new [GBL_GUID] field.
... View more
09-29-2017
10:21 AM
|
2
|
4
|
18579
|
|
POST
|
Look into strip(). If you don't pass any parameters, the function will remove spaces before and after a string. I don't know if that will help or not.
... View more
09-26-2017
12:44 PM
|
1
|
0
|
3894
|
|
POST
|
Did you try: where = 'UPPER("EmergencyServiceZones.POLICE") = UPPER("msag_temp.Police")' ?
... View more
09-22-2017
10:46 AM
|
0
|
0
|
1950
|
|
POST
|
I think you need to remove the ( , newline='') from the open cursor. Try the code below and see what you get. with open('dataTester.csv', 'w') as fp:
a= csv.writer(fp, delimiter=',')
for line in data:
a.writerows(line)
... View more
09-22-2017
10:34 AM
|
0
|
2
|
10539
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-28-2024 11:43 AM | |
| 1 | 09-12-2025 07:32 AM | |
| 1 | 10-26-2018 06:50 AM | |
| 1 | 10-26-2018 08:43 AM | |
| 1 | 02-25-2016 07:50 PM |
| Online Status |
Offline
|
| Date Last Visited |
12-02-2025
01:10 PM
|