|
POST
|
Turns out there was indeed something wrong with the join, I was referencing the wrong 'globalid' in the second join. Specifically, I had the globalid of the feature layer ("Nutrient_Bank_Monitoring.globalid") rather than the repeat table ("plot_image_repeat.globalid") Here is my full script that works, just in case it might help someone else who comes across this thread: import arcpy
from arcpy import da
import os
#all variables are from a file geodatabase exported from Survey123
featureTable = arcpy.GetParameterAsText(0) # the Feature layer
repeatTable = arcpy.GetParameterAsText(1) # the image_repeat table
attachTable = arcpy.GetParameterAsText(2) # the image_repeat__ATTACH table
fileLocation = arcpy.GetParameterAsText(3) # Output folder location for the photos
repeatLayer = arcpy.MakeTableView_management(repeatTable, "repeatTable_lyr")
attachLayer = arcpy.MakeTableView_management(attachTable, "attachTable_lyr")
arcpy.AddJoin_management(repeatLayer, "parentglobalid", featureTable, "globalid")
arcpy.AddJoin_management(repeatLayer, "plot_image_repeat.globalid", attachLayer, "REL_GLOBALID")
with da.SearchCursor(repeatLayer, ['plot_image_repeat__ATTACH.DATA', 'plot_image_repeat__ATTACH.ATT_NAME', 'plot_image_repeat__ATTACH.ATTACHMENTID', 'Nutrient_Bank_Monitoring.site', 'Nutrient_Bank_Monitoring.plot', 'plot_image_repeat.plot_direction']) as cursor:
for item in cursor:
attachment = item[0] # blob data type
site = str(item[3])
plotNum = str(item[4])
plotDir = str(item[5])
filenum = "ATT" + str(item[2]) + "_" # i.e. ATT531_
filename = site + "_Plot" + plotNum + "_" + plotDir
if attachment != None:
open(fileLocation + os.sep + filename + '.jpg', 'wb').write(attachment.tobytes())
else:
arcpy.AddMessage('No attachment data for ' + site + ", Plot " + plotNum)
del item
del filenum
del filename
del attachment
... View more
04-28-2020
12:03 PM
|
0
|
3
|
5184
|
|
POST
|
You're right, I used an IF statement and confirmed that all of the attributes for the DATA column are None type. The script runs successfully with this IF statement but just returns "No Attachment data" for all rows. with da.SearchCursor(repeatLayer, ['plot_image_repeat__ATTACH.DATA', 'plot_image_repeat__ATTACH.ATT_NAME', 'plot_image_repeat__ATTACH.ATTACHMENTID', 'Nutrient_Bank_Monitoring.site', 'Nutrient_Bank_Monitoring.plot']) as cursor:
for item in cursor:
attachment = item[0] # blob data type
site = str(item[3])
plotNum = str(item[4])
filenum = "ATT" + str(item[2]) + "_" # i.e. ATT531_
filename = site + "_Plot" + plotNum + "_" + filenum + str(item[1]) #i.e. miyagi_creek_Plot6_ATT531_plot_image-20200324-143302.jpg
if attachment != None:
open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes())
else:
arcpy.AddMessage('No Attachment data')
del item
del filenum
del filename
del attachment So, something must be going wrong with the join. (again, this issue does not occur when I do the joins manually). Any ideas? Thanks again for the help!
... View more
04-28-2020
10:56 AM
|
0
|
5
|
5184
|
|
POST
|
Hi David, thanks for your response. I had to use the makeTableView function because I am working with a table rather than a layer: repeatLayer = arcpy.MakeTableView_management(repeatTable, "repeatTable_lyr") However, then I run into this error, 'NoneType' object has no attribute 'tobytes' So I guess you can't use that function on a table view? If so, how can I access that information to be able to export the photo and assign it a custom file name?
... View more
04-28-2020
10:06 AM
|
0
|
7
|
5184
|
|
POST
|
Yeah, possibly! Did you just recently update to a new version of Pro or something? That might explain why you didn't see this behavior before but now you are.
... View more
04-27-2020
09:59 AM
|
0
|
0
|
4287
|
|
POST
|
That does seem a bit strange. So, after confirming that when you go to the pop-up configuration settings under visualization, it shows the correct Alias here, and the layer configurations have been saved.... Can you try adding the layer to a new web map and see if the aliases will display in the pop-up?
... View more
04-27-2020
09:39 AM
|
0
|
2
|
4287
|
|
POST
|
Are you getting a specific error message when trying to sync?
... View more
04-27-2020
08:14 AM
|
0
|
0
|
1026
|
|
POST
|
Hi Suzanne, First off, just a tip about posting to Geonet, you don't need to write that much text in the title of the question. There is a character limit, so your text will get cut off, which is what happened here. Just use the title as a general synopsis of what your question is about (in this case, something like "Field Alias not being retained after publishing to ArcGIS Online") and then put more details about the situation in the body of the question. Even with the text cut off, I think I can understand what you're getting at. So the pop-up is showing correctly with field aliases used when you look at the visualization tab through the Item Details page, but not when you view the pop-up in a specific web map?
... View more
04-27-2020
07:34 AM
|
0
|
4
|
4287
|
|
POST
|
I am attempting to automate a process of exporting photos from a Survey123 geodatabase and give the output a custom filename, modified from the general script for exporting photos provided by Esri. Here is what I have so far. I am trying to join the Feature Layer, image_repeat table and image_repeat__ATTACH table before exporting the photos so that I can use fields that are in the feature class attribute table in the output file names. import arcpy
from arcpy import da
import os
featureTable = arcpy.GetParameterAsText(0) # the Feature layer
repeatTable = arcpy.GetParameterAsText(1) # the image_repeat table
attachTable = arcpy.GetParameterAsText(2) # the image_repeat__ATTACH table
fileLocation = arcpy.GetParameterAsText(3) # Output folder location for the photos
arcpy.AddJoin_management(repeatTable, "parentglobalid", featureTable, "globalid")
arcpy.AddJoin_management(repeatTable, "Nutrient_Bank_Monitoring.globalid", attachTable, "REL_GLOBALID")
with da.SearchCursor(repeatTable, ['DATA', 'ATT_NAME', 'ATTACHMENTID', 'site', 'plot']) as cursor:
for item in cursor:
attachment = item[0] # blob data type
site = str(item[3])
plotNum = str(item[4])
filenum = "ATT" + str(item[2]) + "_" # i.e. ATT531_
filename = site + "_Plot" + plotNum + "_" + filenum + str(item[1]) #i.e. miyagi_creek_Plot6_ATT531_plot_image-20200324-143302.jpg
open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes())
del item
del filenum
del filename
del attachment However, I get the following error message - "The value cannot be a table": I have no problem doing the joins manually in ArcMap, so I'm unclear why it won't work in the script. Is it possible to do what I'm trying to do? I am obviously still a python newbie, so many thanks in advance for any help or advice!
... View more
04-26-2020
03:40 PM
|
0
|
11
|
6187
|
|
POST
|
Rickey's answer definitely works if the URL is contained neatly in a different field and you just want to add two different fields together. However, based on your question, it sounds like the URL might be contained within a larger paragraph, and you only want to extract certain text from the paragraph to put in the URL field? If so, I believe Regex (Regular Expressions) or some other more advanced field calculation will be your answer. Are you able to share an example of one of the fields so we can see how it's formatted?
... View more
04-23-2020
05:32 AM
|
0
|
0
|
1325
|
|
POST
|
Do you need super high accuracy for your data collection? If it's not critical, you could lower the accuracy threshold in the app settings for a quick fix.
... View more
04-23-2020
05:20 AM
|
0
|
0
|
1624
|
|
POST
|
Molly Foley, have you thought about using ArcGIS QuickCapture, if speed of collection is really important for this project?
... View more
04-22-2020
08:38 AM
|
0
|
1
|
2382
|
|
POST
|
Hmmm.....good catch! So with "Show Domain and Subtype Descriptions" unchecked, it displays the code in the attribute table as expected, but this setting does not apply to the dropdown when editing the attributes of a feature. I would maybe add this comment to the Idea page I linked to, especially since it says "partially implemented". Might be something they would consider!
... View more
04-21-2020
08:11 AM
|
2
|
9
|
19144
|
|
POST
|
I spoke too soon....I did find this post that explains some (somewhat) newer features that were released with version 2.2 Turning off Coded Domain Value Display in ArcGIS Pro
... View more
04-21-2020
06:58 AM
|
0
|
11
|
19142
|
|
POST
|
In this case, is there a reason that you would want the code displayed instead of the description? I like to think of the Code like a field name, and the Description like a field alias, so normally that's what you would want displayed in the dropdown. Like you, I found this article about changing the settings to display the code in ArcMap, but I am also not finding this same functionality in ArcGIS Pro. It would be interesting to know if this is planned for a future release, or if we're both just missing something! In the meantime, if you really want your dropdown to display (for example) "RES" instead of "Reserved Assigned Parking", you can just put RES in the description field.
... View more
04-21-2020
06:54 AM
|
0
|
12
|
19142
|
|
POST
|
I'm a bit late in discovering this, but thank you so much for starting this thread, Kory Kramer! I obviously can't take credit for this one, but wanted to share a link to this post about ArcGIS Pro Ribbon, Toolbar, and UI Hacks. I customized my ribbon in a very similar way that is outlined in the post, and it made navigation much easier for me and really helped ease the transition process between ArcMap and ArcGIS Pro!
... View more
04-21-2020
05:32 AM
|
2
|
0
|
4264
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | yesterday | |
| 4 | yesterday | |
| 1 | yesterday | |
| 30 | yesterday | |
| 1 | yesterday |
| Online Status |
Online
|
| Date Last Visited |
7 hours ago
|