Ich arbeite mit vielen Kunden, die die Möglichkeit anfragen, ihre Feature Service Anhänge im Popup der Web Map anstelle eines Hyperlinks anzuzeigen. Das angehängte Skript konvertiert die URL der Feature Service Anhänge in ein Feld. Sie können dann den Anhang nach einiger Konfiguration direkt im Popup anzeigen.<\/P>
<\/P>
Hier ist ein Screenshot, wie Anhänge standardmäßig innerhalb eines Web Map Popups angezeigt werden:<\/P>
Unten sind die Schritte aufgeführt, um das angehängte Bild direkt im Popup anzuzeigen:<\/P>
1. Fügen Sie ein TEXT\/STRING-Feld hinzu<\/A> (z. B. "Picture<\/STRONG>") zum Feature Service hinzu, das eine große Anzahl von Zeichen unterstützen kann (z. B. 1.000).<\/P>2. Führen Sie das angehängte GP-Tool aus.<\/P>3. Konfigurieren Sie das Popup, um Bilder anzeigen<\/A>. Beispiel:<\/P> <\/P><\/P> <\/P>Das Bild wird nun direkt im Popup angezeigt. Beispiel:<\/P> <\/P><\/P> <\/P>Hinweise: <\/STRONG><\/P>Die Timeout-Dauer für einen ArcGIS Online Feature Service ist auf maximal 15 Tage eingestellt.<\/LI>Die Timeout-Dauer für einen ArcGIS Server Service ist auf die Standardeinstellung 'Lifespan of long lived token' gesetzt. Der Standardwert beträgt 1 Tag. Dies kann geändert werden, indem Sie zu Server Manager > Security > Settings gehen. Nach der Aktualisierung des long lived token können Sie den Ablaufparameter in Zeile 33 aktualisieren.<\/LI>Da das Token abläuft, können Sie die Parameter im Skript aktualisieren, sodass dies mit dem Windows Task Scheduler<\/A> ausgeführt werden kann. Hier ist ein Beispiel, wie die Parameter konfiguriert werden:<\/LI><\/UL><\/P> <\/P>Ein Video des Workflows finden Sie unten:<\/P>https:\/\/www.youtube.com/watch?v=WpLJBZ9gnuw<\/A><\/P>
Das Bild wird nun direkt im Popup angezeigt. Beispiel:<\/P>
Hinweise: <\/STRONG><\/P>Die Timeout-Dauer für einen ArcGIS Online Feature Service ist auf maximal 15 Tage eingestellt.<\/LI>Die Timeout-Dauer für einen ArcGIS Server Service ist auf die Standardeinstellung 'Lifespan of long lived token' gesetzt. Der Standardwert beträgt 1 Tag. Dies kann geändert werden, indem Sie zu Server Manager > Security > Settings gehen. Nach der Aktualisierung des long lived token können Sie den Ablaufparameter in Zeile 33 aktualisieren.<\/LI>Da das Token abläuft, können Sie die Parameter im Skript aktualisieren, sodass dies mit dem
Ein Video des Workflows finden Sie unten:<\/P>
I managed to this successfully before for a map but I get this error trying to run it now.
Executing: AttachmentstoPopup false true siteadmin ***** http://gis.auglaizecounty.org/arcgis/rest/services/BrdofElections/VotingPrecinctsTestForPictures/MapServer/0 # PictureStart Time: Wed Jul 19 14:08:25 2017Running script AttachmentstoPopup...Failed script AttachmentstoPopup...
Traceback (most recent call last): File "c:\program files (x86)\arcgis\desktop10.4\ArcToolbox\Toolboxes\Convert Attachments.tbx#AttachmentstoPopup.py", line 96, in <module>KeyError: 'updateResults'
Failed to execute (AttachmentstoPopup).Failed at Wed Jul 19 14:08:25 2017 (Elapsed Time: 0.49 seconds)
Hi Jake,
I ran this tool on a number of hosted feature layers and it worked great! However, these feature layers are continually being updated by field crews using Collector and it appears as though the attachment path gets broken as soon as another user adds/edits geometry/attributes in those feature layers with attachments. This seems to break the photo path for all records in the feature layer. In looking at the paths, it seems like the token gets changed for all attachments in the feature layer ("8?token=iSfCjwRyNOfrk-I......" vs "8?token=fsWapS3kGkwPwVz....."). Any way to avoid this?
Thanks!
Now the thumbnails are not showing, and when I click on them to open the image links, I get sent to a page that says Invalid token. Do you know how to fix this?
Here's the map: ArcGIS Web Application
Receiving the same error... any updates on the solution?
seanwhitcomb the token will only last 15 days. This is the maximum. After 15 days you will need to re-execute the tool so that a new token is generated and appended to the attachments URL.
peter.dalrymple I could not reproduce this. I tested with an ArcGIS Online Hosted Feature service. Has it been 15 days since the tool has been executed? The maximum time a token can exists is 15 days. After 15 days the tool needs to be re-executed to update the attachment URL with a new token.
Greetings Jake,
A million thanks once again for figuring out the solution earlier with using this tool with arcgis online (Hosted feature service). However, my major issue is occurring in my on-premise ArcGIS Server (AGS) environment. Please see below for how the tool is setup:
Here is the error:
Please advise.
Thanks in advance
troydawson your specifying the Map Service URL. This script will edit the service, so you will need to specify the Feature Service URL. Ex:
.....MAPS/topographic_data/FeatureServer/3
Thanks for taking the time to respond. I made the change but to no avail. The tool is saying that the script was completed successfully yet no photos.
See below:
troydawson I would need to take a look at the service. You can send me a private message on GeoNET with the service URL if you'd like. I will also need a username/password if it is secure.
trying to send the details you requested. It appears you need to be following me as well in order for the private massage to work via geonet. Please follow so that I can forward the details.
I was able to get my attached photos to display in my pop-ups using your script. All the photos are of trees in the city parks, so the portrait orientation is generally best. When they appear in the pop-up, they have been rotated to a landscape orientation--the tree photos are all sideways. Any thoughts on how I might fix this?
Btw, your script is fantastic--the staff in the Parks department love the pop-up photos.
Jeff
njbaker when you open the attachment link (attachment1.jpg) does the photo appear as it does in the pop-up?
When clicking the link attachment1.jpg, the photo appears correctly (in portrait) in a new tab.
Thanks a million for you help Jake... after enabling feature access and executing, the tool worked successfully.
@Jeff_Baker this is strange behavior. The pop-up should honor how the photo appears in the attachment. I'll let you know if I find a workaround.
Jeff Baker if you're still experiencing the photo rotation issue you may want to take a look at this script:
/blogs/StephaniesGISCorner/2017/08/17/how-to-rotate-image-feature-attachments-on-a-hosted-feature-service
This tool worked well but I had to /0 after the feature service URL in order for it to work. Cheers!
@Sharon_Janzen, yes always check the Tool Help dialog if you run into issues. It will provide further information for each parameter:
Thanks for the great tool! I will be using it regularly.
Is there a version for Python 3.5 so I can run it with ArcGIS Pro 2.0? I tried updating the script using Pro's Analyze Tools for Pro, but I can't get it to work.
epena6 I went ahead and updated the tool. It should now work in Pro.
Thanks for doing that! It works like a charm.
I downloaded the tool, and tried to get it to run from ArcMap. The tool extracted as an empty toolbox, three python scripts, and a pyc file. So I brought the toolbox into ArcToolbox and tried adding the python scripts, naming them as they are named. Then I tried running them, but I never was presented with any parameters to fill with login infomation, service name, etc.. Perhaps I did something wrong, or perhaps it is because I am still running 10.3.1? It looks like AttachmentsToPopup.py is meant to run first.
RYesri it could be the version of ArcGIS Desktop your using. The recent update I used 10.5.1. Are you able to upgrade?
Can you also display an attachment using arcade expression? The problem I have is that I don't know the attachment ID, is there a trick for this in arcade expression?
For example: /FeatureServer/0/1/attachments/X? (X=first attachment ID)
Jake, I have looked all over for a solution like this - thank you for providing it. When I run the toolbox through ArcMap, I get an error saying "Feature service does not contain attachments." I have confirmed that attachments are enabled, the service is editable, and that every object has an attachment. Do you have any suggestions?
Hi Jake, first of all, thank you for putting this script up. Sorry if this is a rather basic question. I've tried using your GP tool a couple of times but keep ending up with this error
I'm not sure what's going on, would you be able to advise?
annehulsey and @E_T if you can share the service you are having issues with to a group in ArcGIS Online. You can then invite my user account (jskinner_CountySandbox) to this Group. I can take a look to see what's going on.
Hi Jake, I've sent an invite to you for the group. Tried executing the tool again, and this time got a different error:
Error: Line 36 -- "token = data['token']": 'token'
annehulsey your field Popup_URL is not big enought:
Try increasing this to a length of 1,000.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registrieren Sie ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.