POST
|
I have a folder with geotagged photos from a DJI drone that I am trying to use the Geotagged Photos to Points tool. It is working perfectly, except I get different results when I run the process in Arcpy than when I do it through the geoprocessing tool. When I run the following code (in a Notebook), there is only one point that corresponds with the last photo. However, each photo/line in the attribute table is also located at that point: folder = 'Z:\\folder'#folder with the photos in it
outputGDB = r"G:\\geodatabase.gdb\\" #full file path of geodatabase where point FC will be stored
FLID = '339'#flight ID
gtphoto = arcpy.management.GeoTaggedPhotosToPoints(folder, outputGDB + "FLID_" + FLID, None, "ALL_PHOTOS", "ADD_ATTACHMENTS") However, when I go into my geoprocessing history and pull up the Geotagged Photos to Points tool I just ran, delete the point FC, and rerun the tool, it works the way it should. I get a point file with a point for each photo where they should be. Why are the results different when I run the tool in Notebooks than in the geoprocessing window when the parameters are the same? Bug, or issue with code?
... View more
01-27-2021
07:56 AM
|
0
|
1
|
856
|
POST
|
I am writing a script tool that will take a list of rasters and stack them up so they align perfectly using resample and snap raster. I have the script written and the script tool assembled, but I keep getting this error: ERROR 000865: Input raster: D:\folder\file1;D:\folder\file2 does not exist. In my script tool, I have the parameters set so the input is a Raster Dataset and I have checked the multiple values box so I can input multiple rasters. I noticed that the raster is coming back as a semi-colon delimited string, so I tried both GetParamter() and GetParameterAsText(), but neither of them work: rasterList = arcpy.GetParameterAsText(1).split(';')
rasterList = arcpy.GetParameter(1) Based on some print statements it looks like the error is coming before it even gets into my script (none of the AddMessage statements return anything before the error is thrown), but I can add some of my code if that's helpful. I'll also add that if I only add one raster it works fine (well, it throws an error when it gets to a loop running through the list that it's supposed to be creating) but it doesn't give me an error about a file not existing. It looks like it's reading the semi-colon delimited string as one raster that does not exist?
... View more
10-07-2020
12:54 PM
|
0
|
0
|
1420
|
POST
|
renaming datetime as dt when I imported it seems to have solved the issue. Thanks!
... View more
06-19-2020
07:52 AM
|
0
|
0
|
1243
|
POST
|
I have a script tool that populates a "season" field based on the date of the point. For example, if the point is between Nov 1 and Feb 29, the "season" field is "Winter". It also looks to see if a particular individual is in a "nesting" or "brooding" list and, if so, that influences the season type. The tool works fine when I copy and paste the code in to the python window in ArcGIS Pro 2.4, but when run as a script tool, I get the following error: AttributeError: type object 'datetime.datetime' has no attribute 'datetime'. The error is thrown on line 11 below. Everything looks fine in the output and the print statements as I run it in the python window, as far as I can tell. It's probably something simple as this is the first time I've used the datetime module, but I'm confused why as a tool it won't recognize the datetime.datetime attribute import datetime
full = "name of feature class"
nesting = ['bird1', 'bird2', 'bird3']
brooding = ['bird4', 'bird5', 'bird6']
with arcpy.da.UpdateCursor(full, ['Date', 'Month', 'Year', 'Season', 'SEX', 'NAME']) as cursor:
for row in cursor:
if row[3] == None:
d = datetime.datetime(int(row[2]), int(row[1]), int(row[0]))
print(d)
arcpy.AddMessage(d)
if row[4] == 'MALE':
if d >= datetime.datetime(int(row[2]), 3, 1) and d <= datetime.datetime(int(row[2]), 6, 15):
row[3] = 'Breed'
cursor.updateRow(row)
elif d >= datetime.datetime(int(row[2]), 6, 16) and d <= datetime.datetime(int(row[2]), 8, 31):
row[3] = 'Summer'
cursor.updateRow(row)
elif d >= datetime.datetime(int(row[2]), 9, 1) and d <= datetime.datetime(int(row[2]), 10, 31):
row[3] = 'Fall'
cursor.updateRow(row)
elif d >= datetime.datetime(int(row[2]), 11, 1) and d <= datetime.datetime(int(row[2]), 12, 31):
row[3] = 'Winter'
cursor.updateRow(row)
elif d >= datetime.datetime(int(row[2]), 1, 1) and d <= datetime.datetime(int(row[2]), 2, 29):
row[3] = 'Winter'
cursor.updateRow(row)
elif row[4] == 'FEMALE':
#fall
if d > datetime.datetime(int(row[2]), 8, 31) and d < datetime.datetime(int(row[2]), 11, 1):
row[3] = 'Fall'
cursor.updateRow(row)
#winter
elif d > datetime.datetime(int(row[2]), 10, 31) and d <= datetime.datetime(int(row[2]), 12, 31):
row[3] = 'Winter'
cursor.updateRow(row)
elif d >= datetime.datetime(int(row[2]), 1, 1) and d < datetime.datetime(int(row[2]), 3, 1):
row[3] = 'Winter'
cursor.updateRow(row)
#Breed
elif row[5] not in nesting and row[5] not in brooding and d >= datetime.datetime(int(row[2]), 3, 1) and d <= datetime.datetime(int(row[2]), 6, 15):
row[3] = 'Breed'
cursor.updateRow(row)
elif row[5] in nesting and d >= datetime.datetime(int(row[2]), 4, 10) and d <= datetime.datetime(int(row[2]), 6, 20):
row[3] = 'Nest'
cursor.updateRow(row)
elif row[5] in brooding and d >= datetime.datetime(int(row[2]), 5, 5) and d <= datetime.datetime(int(row[2]), 9, 1):
row[3] = 'Brood'
cursor.updateRow(row)
elif row[5] not in brooding and d >= datetime.datetime(int(row[2]), 6, 16) and d <= datetime.datetime(int(row[2]), 8, 31):
row[3] = 'Summer'
cursor.updateRow(row)
else:
print('assign point manually')
else:
print('Type already calculated')
cursor.updateRow(row)
print('done')
arcpy.AddMessage("Complete")
... View more
06-18-2020
10:20 AM
|
0
|
2
|
1316
|
POST
|
Updates since yesterday: Bruce: I ran the tool you linked to and it finished running. I set it to comma delimited and it gave me a .tsv file which I'm having trouble opening, but based on the file size it looks like it's the same number of points I've been getting from the other methods I've tried. The points are just a feature class in a file GDB. I realized as well that I needed an XY field to reload the points back into ArcPro after the work in R Studio if I go the .csv route, so I ran the Add Geometry Attributes tool. It ran for 25 minutes and got to 40%, then completed and it only calculated the values for the 3 million rows. I then discovered I have access to a machine with 32GB of RAM (compared with the 16 on mine), so I went and ran the Add Geometry Attributes tool on that machine. It processed for about 20 minutes and finished, but now my feature class only has the 3 million points and visually only covers about a third of what it did before. So, it appears I somehow deleted the 6 million points that weren't being touched. Now to find my backup/rebuild my point file... I'm thinking I'm going to try to abandon this method and go to working with raster in R Studio (the point file was generated using raster to point) and see if that will solve my issues. But it appears that there might have been some sort of RAM issue?
... View more
05-06-2020
09:49 AM
|
0
|
1
|
3996
|
POST
|
The tools execute fine, the results just don't have all of the rows. I also noticed that if I open the attribute table and scroll to the bottom it works for about 30 seconds and then ArcPro crashes (without loading the last rows of the table). Could it be a RAM issue or something? Not sure if insufficient RAM would influence the tool results if it doesn't give me an error though.
... View more
05-05-2020
01:47 PM
|
0
|
0
|
3996
|
POST
|
I have a point feature class that has 9.2 million rows (according to the counter on the attribute table) and ~50 columns. I am trying to get it in to R to run some statistical analysis on it. I'm having issues exporting the whole table in a usable format (it is only exporting around 3 million rows). A few things I have tried: 1. ArcGIS Binding (it only brings in ~3 million rows to R). 2. Copy Rows tool with .csv extension (also only getting ~3 million rows) 3. Subset Features tool with the parameters set as 33.3%, thinking I could export it 3 times and then merge it in R (this only gives me 1.2 million rows, or 1/3 of what I'm getting with the other two methods) 4. A python script that selects 1 million rows and exports it as an excel table, then selects the next 1 million rows, etc. This runs until the 3rd iteration and then ends (because I've reached this strange ~3 million number) 5. Exporting from ArcMap as a table (same thing) I'm a little confused because the attribute table is definitely saying that I have 9 million rows, but nothing else I try seems to recognize that. I'm not aware with any sort of limit of features on any of these methods (for example, a .csv should be able to handle 9 million rows, as does R Studio). Is there a limit I'm not aware of, or some sort of known bug with the attribute table and there really is only 3 million rows in my feature class? What is the best way to get a table this size as .csv format?
... View more
05-05-2020
12:40 PM
|
0
|
8
|
4377
|
POST
|
I have a list of wildlife points that I'm collecting using Survey123, which I then load directly into a web map on ArcGIS Online. I have ~15 individuals, and I would like to set it up to automatically filter all but the last point. I am seeing posts on updating the SQL query to show only the point collected in the last day; however, I need my filter to be a little bit more variable than that. For example, individual 1 might be located on Monday and Friday, individual 2 on Wednesday, etc., and on Saturday I only want to display the Friday point for individual 1 and the Wednesday point for individual 2, and so on for each individual. I can do this within a web map or web app setting, I just want to dynamically see where the individual was last seen. What is the best way to go about this?
... View more
04-22-2020
08:53 AM
|
0
|
2
|
1286
|
POST
|
I have a feature class with just under 9.5 million rows that I want to load in R Studio. Here is my code: arc.check_product()
point = arc.open(path = "...\\my.gdb\\my_feature_class")
point.df = arc.select(point) However, it says it only loaded 3.6 million rows in my R Studio environment. I know that R Studio should be able to handle all of the rows because the following works fine: dat <- data.frame(X=rep(0, 92500000)) I do have ~75 columns, so is there some other memory limitation I don't know about? Why would it not load my whole dataset? I have done this with several smaller datasets (~20k rows) without any issue. Thanks in advance
... View more
03-23-2020
08:42 AM
|
0
|
0
|
458
|
POST
|
I have a point feature class that has a unique ID field and a julian date field. I also have a pile of rasters in a geodatabase that have daily values that I want to extract to the corresponding date in the point file. I have already written a script that goes through and renamed them so that the julian date is tagged on to the end of the name of the raster. To do this, I have the following code: input = point feature class
#Iterate through to extract values to points based on date
arcpy.env.workspace = #geodatabase with the rasters
fl = arcpy.ListRasters()
dict = {}
for feature in fl:
j = feature[-5:-1] + feature[-1]#returns the julian date
with arcpy.da.SearchCursor(input, ["julian"]) as cursor:
for row in cursor:
if row[0] == int(j):
temp = #temporary output string
table = arcpy.sa.ExtractValuesToPoints(input, r'string for geodatabase' + feature, r"ouput geodatabase" + feature + "_testtable")
with arcpy.da.SearchCursor(table, ['ID', 'RASTERVALU']) as cursor2:
for row2 in cursor2:
ID = row2[0]
value = row2[1]
dict.update({ID : value})
arcpy.Delete_management(table)
else:
print('not equal' + str(row[0]))
with arcpy.da.UpdateCursor(input, ['ID', "Value column"]) as cursor:
for row in cursor:
row[1] = dict[row[0]]
cursor.updateRow(row) I think the problem is line 15; the input for the Extract Values to Points tool is being overwritten by the last raster that it iterates over. So, the values for November 6th are writing over all of the previous dates in the dictionary and subsequently the point feature class. How do I code this so that it only runs the Extract Values to Points tool on the selected row in the search cursor?
... View more
02-04-2020
09:34 AM
|
0
|
2
|
1035
|
POST
|
Thanks Dan. I figured it would be something embarrassingly obvious like that. It worked great.
... View more
01-24-2020
11:36 AM
|
1
|
0
|
1600
|
POST
|
I have a field for aspect (short integer) with values ranging from 1-4. I want to have 3 additional columns: aspect2, aspect3, aspect4 that are calculated based on the aspect field (for example, if the aspect field is 2, then aspect2 = 1, aspect3 =0 and aspect4 =0). Here is the code I have: arcpy.AddField_management(input, 'aspect2', 'SHORT')
arcpy.AddField_management(input, 'aspect3', 'SHORT')
arcpy.AddField_management(input, 'aspect4', 'SHORT')
with arcpy.da.UpdateCursor(input, ['aspect', 'aspect2', 'aspect3', 'aspect4']) as cursor:
for row in cursor:
if cursor[0] == 2:
cursor[1] = 1
cursor[2] = 0
cursor[3] = 0
cursor.updateRow(row)
elif cursor[0] == 3:
cursor[1] = 0
cursor[2] = 1
cursor[3] = 0
cursor.updateRow(row)
elif cursor[0] == 4:
cursor[1] = 0
cursor[2] = 0
cursor[3] = 1
cursor.updateRow(row)
else:
cursor[1] = 0
cursor[2] = 0
cursor[3] = 0
cursor.updateRow(row) When I run it, I get the following error: Traceback (most recent call last): File "<string>", line 19, in <module> TypeError: 'da.UpdateCursor' object does not support item assignment I'm not sure if it's a basic syntax issue (it's very possible) or I'm not thinking about it correctly. Any ideas are greatly appreciated.
... View more
01-23-2020
12:05 PM
|
0
|
2
|
1722
|
POST
|
I have a hosted view layer on a webmap in which the hosted layer is being actively edited. I want the functionality to export a query using the query widget on the WebApp builder, but I would like to control the user option for what to export. Specifically, when I test it and export a CSV, it exports every field in the view layer, even though they are turned off and not visible on the layer before running the query. Is there a way to restrict the export to only include the fields that are visible in the view layer on which the query is based? Similarly, is it possible to restrict the format so that the user can only export a CSV?
... View more
01-08-2020
03:00 PM
|
0
|
2
|
624
|
POST
|
I have a table on ArcGIS online that has a mix of point features, some have geometry assigned to them and display on the map while others do not have a point assigned to them. I would like to be able to select a given row and manually drop a point to be associated with that row. It looks like this will work in ArcGIS Pro if I select the row and use the Replace Geometry tool in the Editing panel. Is there a way to perform this edit directly on AGOL? Thank you for any suggestions
... View more
11-26-2019
08:43 AM
|
1
|
1
|
1940
|
Title | Kudos | Posted |
---|---|---|
1 | 11-26-2019 08:43 AM | |
1 | 02-21-2019 01:52 PM | |
1 | 03-07-2019 01:21 PM | |
1 | 01-24-2020 11:36 AM |
Online Status |
Offline
|
Date Last Visited |
01-27-2021
02:11 PM
|