Eu trabalho com muitos clientes que solicitam a capacidade de exibir os anexos do serviço de feição no popup do mapa web em vez de um hiperlink. O script anexado converterá a URL dos anexos do serviço de feição em um campo. Você pode então exibir o anexo diretamente no popup após alguma configuração.<\/P>
<\/P>
Aqui está uma captura de tela de como os anexos são exibidos dentro de um popup de mapa web por padrão:<\/P>
Abaixo estão os passos para mostrar a imagem anexada diretamente no popup:<\/P>
1. Adicione um campo TEXT\/STRING<\/A> (ou seja, "Picture<\/STRONG>") ao serviço de feição que possa suportar uma grande quantidade de caracteres (ou seja, 1.000).<\/P>2. Execute a ferramenta GP anexada.<\/P>3. Configure o pop-up para Mostrar Imagens<\/A>. Ex:<\/P> <\/P><\/P> <\/P>A imagem agora será exibida diretamente no popup. Ex:<\/P> <\/P><\/P> <\/P>Notas: <\/STRONG><\/P>o tempo limite para um serviço de feição ArcGIS Online é definido para o máximo de 15 dias.<\/LI>o tempo limite para um serviço ArcGIS Server é definido para o padrão 'Lifespan of long lived token'. O padrão é 1 dia. Isso pode ser alterado acessando Server Manager > Security > Settings. Após o token de longa duração ser atualizado, você pode atualizar o parâmetro de expiração na linha 33.<\/LI>Como o token expirará, você pode atualizar os parâmetros no script para que isso possa ser executado com o Windows Task Scheduler. Aqui está um exemplo de como configurar os parâmetros:<\/LI><\/UL>
A imagem agora será exibida diretamente no popup. Ex:<\/P>
Notas: <\/STRONG><\/P>o tempo limite para um serviço de feição ArcGIS Online é definido para o máximo de 15 dias.<\/LI>o tempo limite para um serviço ArcGIS Server é definido para o padrão 'Lifespan of long lived token'. O padrão é 1 dia. Isso pode ser alterado acessando Server Manager > Security > Settings. Após o token de longa duração ser atualizado, você pode atualizar o parâmetro de expiração na linha 33.<\/LI>Como o token expirará, você pode atualizar os parâmetros no script para que isso possa ser executado com o
Um vídeo do fluxo de trabalho pode ser encontrado abaixo:<\/P>
https:\/\/www.youtube.com/watch?v=WpLJBZ9gnuw<\/_a>
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.
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.