Ik werk met veel klanten die de mogelijkheid willen om hun feature service-bijlagen weer te geven in de web map-popup in plaats van een hyperlink. Het bijgevoegde script zet de URL van de feature services-bijlagen om naar een veld. U kunt de bijlage dan direct in de popup weergeven na enige configuratie.<\/P>
<\/P>
Hier is een screenshot van hoe bijlagen standaard worden weergegeven binnen een web map-popup:<\/P>
Hieronder staan de stappen om de bijgevoegde afbeelding direct in de popup te tonen:<\/P>
1. Voeg een TEKST\/STRING-veld toe<\/A> (bijv. "Picture<\/STRONG>") aan de feature service dat een groot aantal tekens kan ondersteunen (bijv. 1.000).<\/P>2. Voer het bijgevoegde GP-hulpmiddel uit.<\/P>3. Configureer de pop-up om Afbeeldingen weer te geven<\/A>. Bijv:<\/P> <\/P><\/P> <\/P>De afbeelding wordt nu direct in de popup weergegeven. Bijv:<\/P> <\/P><\/P> <\/P>Opmerkingen: <\/STRONG><\/P>de time-out voor een ArcGIS Online feature service is ingesteld op maximaal 15 dagen.<\/LI>de time-out voor een ArcGIS Server-service is ingesteld op de standaard 'Lifespan of long lived token'. De standaard is 1 dag. Dit kan worden gewijzigd via Server Manager > Security > Settings. Nadat het long lived token is bijgewerkt, kunt u de vervaldatumparameter op regel 33 aanpassen.<\/LI>Aangezien het token verloopt, kunt u de parameters in het script aanpassen zodat dit kan worden uitgevoerd met Windows Task Scheduler<\/A>. Hier is een voorbeeld van hoe u de parameters configureert:<\/LI><\/UL><\/P> <\/P>Een video van de workflow vindt u hieronder:<\/P>https:\/\/www.youtube.com\/watch?v=WpLJBZ9gnuw<\/A><\/P>
De afbeelding wordt nu direct in de popup weergegeven. Bijv:<\/P>
Opmerkingen: <\/STRONG><\/P>de time-out voor een ArcGIS Online feature service is ingesteld op maximaal 15 dagen.<\/LI>de time-out voor een ArcGIS Server-service is ingesteld op de standaard 'Lifespan of long lived token'. De standaard is 1 dag. Dit kan worden gewijzigd via Server Manager > Security > Settings. Nadat het long lived token is bijgewerkt, kunt u de vervaldatumparameter op regel 33 aanpassen.<\/LI>Aangezien het token verloopt, kunt u de parameters in het script aanpassen zodat dit kan worden uitgevoerd met
Een video van de workflow vindt u hieronder:<\/P>
Thanks Jake, this will be handy for one of my web maps that show the reports for the impaired waters and water bodies across the state. This could save us sometime on the back end.
How does this handle MULTIPLE attachments?
Currently, this code will only show the first attachment in the case where there are multiple.
Exactly what I'm in search for; however, I don't use ArcGIS Online so how do I get this to work in Portal for ArcGIS? I have gotten as far as replacing the baseURL to my feature service URL and Adding the "picture" field. Can someone advise on whatelse is required?
Thanks in advance,
Looking forward to hearing from you guys soon.
Any instructions for this to work in portal for Arcgis?
Can this be configured to work with services hosted on a ArcGIS server and not on AGOL?
Also does this need to be re-ran for each time or is it a one shot deal?
ie if i go out on multiple days and collect data would this have to be ran each day?
Randall,
I've been trying to get an answer to this debacle for the past two(2) weeks to no avail... Hopefully someone out there can provide some answers.
While I have only worked with AGO, it is my understanding that server would work much the same as AGO. You would be accessing the feature via the REST API. In the script that Jake attached, you would need to change username, password, baseURL, tokenURL, and referer in lines 4 through 6.
For example, baseURL would point to your servers REST point. Instead of pointing to "http / services.arcgis.com /dlFJXQQUk /arcgis/rest/services/DamagedBuildings/FeatureServer/0" , change the "services.arcgis.com/dlFJXQQUk" to point to your server.
I would suggest looking at the REST API documentation for Server.
I might have a fix.
I posted this on a different forum and got a response but i have not tried it out yet. Im going to give a try today or tomorrow but here is link to the post and the response.
I also might try stackexchange
Hi Randy,
Thanks for responding and you are correct (i think)
Its really just a a matter of figuring out what the replacement values are which for a some of us that are new to this part of GIS, it can be hard to figure out where to start looking.
Hopefully that Intro to ArcGIS REST API class i am currently taking will help
I haven't had a chance to look at this for ArcGIS Server, yet, but the code may work just by changing how the token is generated. For example, try the following:
tokenURL = 'http://' + server + '/arcgis/admin/generateToken'
params = {'username': username, 'password': password, 'client': 'requestip', 'f': 'pjson'}
req = urllib2.Request(tokenURL, urllib.urlencode(params))
response = urllib2.urlopen(req)
data = json.load(response)
token = data['token']
You will just need to replace 'server' with the name of the ArcGIS Server instance.
Updated the script to a GP tool that will update an ArcGIS Online feature service, or an ArcGIS Server feature service.
Could this tool be used for dynamic layers (e. g. collecting data with Collector for ArcGIS)? Or I have to repeat this tool everytime I update feature layer?
Great tool! Runs with no error but did not add URLs to the string field in the feature service, which I supplied to the script. The progress dialog indicates "success: False" for all records, yet most do have attachments and they are visible as links in the map.
Hi Neil,
Is it possible for you to share this feature service to a group and invite my user account (jskinner_CountySandbox)? I can try and download the service to see why the field is not updating.
Thanks. Invite sent.
Thanks for the tool! Tried it with one of the services which have single attachments from agol. Even though the service has attacgments, the scripts gives error:
if data["hasAttachments"] == 1:
KeyError: 'hasAttachments'
Failed to execute (AttachmentstoPopup).
any ideas?
-Rupali
Neil, I was going to download the service using a tool I created, but in order to do that 'Sync' needs to be enabled. Can you enable this for the service?
Done. Thanks for taking a look.
Greetings All,
I have attached the original python file provided in the above downloadable zip file and also my edited version of the python file. I have NOT been able to get this GP tool working with ArcGIS Server. Can someone please advise as to what other changes are required to the script in order to get this tool working.
Thank in advance
Original
Edited Version
Did you get this to work on ArcServer? I have followed along but continue to get a line 41 error token not defined.
Hi Hunter,
Is the ArcGIS Server service secure? Also, what type of authentication are you using for your ArcGIS Server security?
I noticed that if you have web tier authentication and the service is not secured, you will still have to specify a username/password.
Ex of web tier authentication:
Hi Troy,
What error are you receiving when you use this tool with an ArcGIS Server service?
Jake, Thanks for the quick reply
I was able to move past the line 41 error by switching the token endpoint from my web adapter URL to the Port number URL.
I am now getting hung up on line 46
Trying to get a bunch of pictures generated from a collector app moved to a pop up for AGOL and then formatted in a report for water quality reporting.
What type of security do you have implemented for ArcGIS Server? Is the service itself secure?
If you'd like, you can share the service URL to a Group on ArcGIS Online, and then invite my username (jskinner_CountySandbox) to that group. I can then view the service and take a look at what's going on.
Jake,
Thanks I just sent you a invite to the service. The service is secure, however I shared it on AGOL to you with credentials attached.
THAT WAS SO EASY! Thank you so much!
This is a great script and I can see several benefits of using it. However, when I trying running it against an AGO feature service, I get the following error. All features have an attachment tied to them. Any assistance would be greatly appreciated. Thanks in advance!
Craig Prisland
I would have to take a look at the service to see what's going on. You can share the service to a Group and invite my AGOL user, jskinner_CountySandbox, to this group if you'd like.
Invite sent. Thanks again for taking a look at this. Just a heads up, you will notice that there are several layers in this feature service. These are all referencing the same data but need certain fields turned on/off depending on CAT selected.
Thanks.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.