|
POST
|
Hmmmm How To: Calculate feature centroids suggests: "In the following sample, the Data Access Module is used to retrieve the centroid coordinates using the SHAPE@XY token." which I interpret as the polygon centroid. If that is indeed a tuple of many coordinates, how does one get the centroid using the da method?
... View more
11-18-2018
07:29 AM
|
0
|
7
|
1993
|
|
POST
|
Here is something interesting: when I try to extend the point-in-polygon script to polygon-centroid-in-polygon (what administrative boundary is this building located in?), if the input polygon intersects the within polygon (building straddles a county boundary), the result is null: with arcpy.da.UpdateCursor(update_feature_class, ['SHAPE@XY', update_name]) as update_cursor:
# Iterate through points
for point in update_cursor:
point_count += 1
name_list = []
for name in poly_names:
comparison_count += 1
poly = relateDict[name]
# Check if the current point is within the current polygon
if point[0].within(poly): # Returns True or False
# Add the polygon name to the list
name_list.append(name)
point[1] = ",".join(name_list)
# Update the cursor with the new value
update_cursor.updateRow(point)
arcpy.AddMessage("Processed {0} Polygon/Polygon or Line comparisons for {1} Polygons and {2} Polygons or Lines".format(comparison_count, poly_count, point_count))
... View more
11-17-2018
12:34 PM
|
0
|
9
|
1993
|
|
POST
|
Richard thanks for the help! I finally had some time to sit down and implement your solution, here's what I got to work with comments, so others can follow. I plan to bake this into a python toolbox and will share. from time import strftime
print("Script Start: " + strftime("%Y-%m-%d %H:%M:%S"))
import arcpy
#Feature class to be updated
update_feature_class = r'C:\Temp\NEAR\GRSM.gdb\Points_Of_Interest\AED_LOCATIONS'
#Feature class containing the attribute we want is nearest
road_feature_class = r'C:\Temp\NEAR\GRSM.gdb\Transportation\GRSM_ROADS'
arcpy.MakeFeatureLayer_management(update_feature_class,"update_lyr")
arcpy.MakeFeatureLayer_management(road_feature_class,"road_lyr")
print("Created Layers: " + strftime("%Y-%m-%d %H:%M:%S"))
#create a temporary table of near results
out_table = r'C:\Temp\NEAR\GRSM.gdb\AED_LOCATIONS_CLOSE'
if arcpy.Exists(out_table):
arcpy.Delete_management(out_table)
print("Deleted Near Table: " + strftime("%Y-%m-%d %H:%M:%S"))
arcpy.GenerateNearTable_analysis("update_lyr", "road_lyr", out_table)
print("Generated Near Table:" + strftime("%Y-%m-%d %H:%M:%S"))
#create a list of attributes from the near feature class where
#the second field is the attribute we want to know is the nearest
roadsFieldsList = ["OBJECTID","RDNAME"]
roadsDict = {r[0]:r[1] for r in arcpy.da.SearchCursor("road_lyr", roadsFieldsList)}
matchFieldsList = ["IN_FID", "NEAR_FID"]
matchDict = {r[0]:roadsDict[r[1]] for r in arcpy.da.SearchCursor(out_table, matchFieldsList)}
#write the nearest attribute to the update feature class
#where the second field is the attribute that is being updated with
#the name of the nearest feature
updateFieldsList = ["OBJECTID", "TEST"]
with arcpy.da.UpdateCursor("update_lyr", updateFieldsList) as updateRows:
for updateRow in updateRows:
keyValue = updateRow[0]
# verify that the keyValue is in the Dictionary
if keyValue in matchDict:
updateRow[1] = matchDict[keyValue]
updateRows.updateRow(updateRow)
print("Updated Features: " + strftime("%Y-%m-%d %H:%M:%S"))
del roadsDict
del matchDict
print("Script Finish: " + strftime("%Y-%m-%d %H:%M:%S"))
... View more
11-17-2018
11:31 AM
|
0
|
0
|
1834
|
|
POST
|
yes and no, the problem is I then have to script, or otherwise automate, the calculation of Z for each new point added.
... View more
11-17-2018
10:16 AM
|
0
|
0
|
1123
|
|
POST
|
I have a new requirement that, in some 200+ ArcGIS Feature Services on Server 10.6.1 (They are not hosted via a PTL), they all get an "ELEVATION" field and users will somehow magically populate the elevation using a local, Lidar-derived DEM (so it can't be the AGOL elevation service). Here's what's not going to work: Use Extract Values to Points (which creates another FC), join back to the original feature service, calculate field using RASTERVALUE: To many steps, users mostly stop understanding the workflow after the word "join". GIS is not these folks job, they GPS some things, add the points to a feature service, need to know the elevation... The requirement is the Lidar-derived elevation, not the GPS one Z-enabling everything. Not possible in our environment, nor feasible given the number of SDE feature classes we'd have to modify. Can't use SQL on the back end like ELEVATION = (SELECT pdata.getValueByLoc(1,p.SHAPE.Long,p.SHAPE.Lat) FROM [dbo].[DEM10MP]), which uses ST_RASTER, an unsafe assembly which we're not allowed to use. Surely someone (many hundreds in fact) have had this requirement....and solved it? Some python toolbox is out there somewhere......
... View more
11-15-2018
11:43 AM
|
0
|
3
|
1271
|
|
POST
|
Are you running the toolbox as a batch? Your py shows 1 input for feature class, yet your screenshot shows many.
... View more
11-13-2018
06:46 AM
|
0
|
0
|
4140
|
|
POST
|
Wow....that's a tech support case for sure.In the Pro version, what happens when you move calc_dr_selection_temp.xlsx to another directory with no spaces or special characters and where your computer login has "Full Control" to the directory?
... View more
11-12-2018
06:50 AM
|
0
|
1
|
6805
|
|
POST
|
Can you share your Python script and toolbox? Not a lot to troubleshoot using just screen shots in a Python error.
... View more
11-10-2018
06:21 AM
|
0
|
8
|
6805
|
|
POST
|
For most organizations, excluding anything from security controls is not an option, and not something that had to be done with ArcMap. We have the same AV problem with ArcGIS Server: AV scans of the install directory slows it to a crawl.
... View more
11-09-2018
06:12 AM
|
1
|
0
|
5153
|
|
POST
|
Would need more details about your workstation: Type of hard drive, processor, ram. I see a lot of difference in Pro "Browse" performance on older or less capable workstations, when we started spec'ing GIS workstation with the Dell Class 40/50 NVMe drives, the "look for stuff" performance increased, but is no where near the performance of Arc Catalog. Your indexing options might help to. But in terms of best advice, your situation seems extreme, and the best advice I have, based on experience (with many successful outcomes), is to call tech support on this one.
... View more
11-08-2018
08:27 AM
|
0
|
10
|
8354
|
|
POST
|
Kory Kramer I haven't tried to repro (it looks like the issue might be happening when there are 100+ layers?), but: Note the commas and spaces in the path and that the path is populating:
... View more
11-08-2018
04:38 AM
|
1
|
1
|
3940
|
|
IDEA
|
The option to sort domain values should be that, an option, and not forced on users. There are many situations where forced domain sorting is not only not needed, but violates business logic. For example, Raw, Valid, Certified, Invalid should be presented in the pick list in exactly that order, not sorted alphabetically ascending or descending.
... View more
11-07-2018
04:50 AM
|
0
|
0
|
2866
|
|
POST
|
I had this issue in the past with ArcMap. As it turned out, there was some sort of automated IT process that kicked everyone off the network share for some sort of AV scan and backup. More details about exactly what is going on on the server overnight is the only way you're going to resolve this case. Is it reproducible when you save it to the local drive and leave it open over night?
... View more
11-07-2018
04:43 AM
|
0
|
1
|
9264
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-17-2022 12:19 PM | |
| 1 | 03-14-2019 06:24 AM | |
| 1 | 07-12-2018 09:29 AM | |
| 1 | 06-27-2019 12:08 PM | |
| 2 | 09-23-2019 11:03 AM |
| Online Status |
Offline
|
| Date Last Visited |
04-26-2026
07:12 AM
|