Trabajo con muchos clientes que solicitan la capacidad de mostrar los archivos adjuntos de su servicio de entidades en el popup del mapa web en lugar de un hipervínculo. El script adjunto convertirá la URL de los archivos adjuntos del servicio de entidades en un campo. Luego puede mostrar el archivo adjunto directamente en el popup después de cierta configuración.<\/P>
<\/P>
Aquí hay una captura de pantalla de cómo se muestran los archivos adjuntos dentro de un popup del mapa web por defecto:<\/P>
A continuación, los pasos para mostrar la imagen adjunta directamente en el popup:<\/P>
1. Agregue un campo TEXT\/STRING<\/A> (es decir, "Picture<\/STRONG>") al servicio de entidades que pueda soportar una gran cantidad de caracteres (es decir, 1,000).<\/P>2. Ejecute la herramienta GP adjunta.<\/P>3. Configure el popup para Mostrar imágenes<\/A>. Ej:<\/P> <\/P><\/P> <\/P>La imagen ahora se mostrará directamente en el popup. Ej:<\/P> <\/P><\/P> <\/P>Notas: <\/STRONG><\/P>el tiempo de espera para un servicio de entidades ArcGIS Online está configurado al máximo de 15 días.<\/LI>el tiempo de espera para un servicio ArcGIS Server está configurado al valor predeterminado 'Lifespan of long lived token'. El valor predeterminado es 1 día. Esto se puede cambiar yendo a Server Manager > Security > Settings. Después de actualizar el token de larga duración, puede actualizar el parámetro expiration en la línea 33.<\/LI>Dado que el token expirará, puede actualizar los parámetros en el script para que esto pueda ejecutarse con Windows Task Scheduler<\strong>. Aquí hay un ejemplo de cómo configurar los parámetros:<\/LI><\/UL>
La imagen ahora se mostrará directamente en el popup. Ej:<\/P>
Notas: <\/STRONG><\/P>el tiempo de espera para un servicio de entidades ArcGIS Online está configurado al máximo de 15 días.<\/LI>el tiempo de espera para un servicio ArcGIS Server está configurado al valor predeterminado 'Lifespan of long lived token'. El valor predeterminado es 1 día. Esto se puede cambiar yendo a Server Manager > Security > Settings. Después de actualizar el token de larga duración, puede actualizar el parámetro expiration en la línea 33.<\/LI>Dado que el token expirará, puede actualizar los parámetros en el script para que esto pueda ejecutarse con
Un video del flujo de trabajo se puede encontrar a continuación:<\/P>
https:\/\/www.youtube.com/watch?v=WpLJBZ9gnuw<\A><\P>
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?
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)
RYesri it could be the version of ArcGIS Desktop your using. The recent update I used 10.5.1. Are you able to upgrade?
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.
Thanks for doing that! It works like a charm.
epena6 I went ahead and updated the tool. It should now work in Pro.
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.
@Sharon_Janzen, yes always check the Tool Help dialog if you run into issues. It will provide further information for each parameter:
This tool worked well but I had to /0 after the feature service URL in order for it to work. Cheers!
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
@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.
Thanks a million for you help Jake... after enabling feature access and executing, the tool worked successfully.
When clicking the link attachment1.jpg, the photo appears correctly (in portrait) in a new tab.
njbaker when you open the attachment link (attachment1.jpg) does the photo appear as it does in the pop-up?
Hi Jake,
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
Greetings Jake,
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.
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.
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:
Please advise.
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
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:
Thanks in advance
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.
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.
Receiving the same error... any updates on the solution?
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
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!
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)
Thank you so much! It looks great.
seanwhitcomb you may want to check your internet connectivity. It took almost 2 hours, but the tool ran successfully.
there we go! That worked out nicely. You were correct, the username is case sensitive and making it into all caps did the trick. Thanks again!
I just added you to the group with the service in question. Thank you so much for working on this.
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate para una cuenta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.