J'ai rencontré de nombreux utilisateurs qui ont demandé la possibilité de télécharger les services de fonctionnalités hébergés ArcGIS Online et les services de fonctionnalités/cartes ArcGIS Server. Voir l'outil ci-joint pour faire exactement cela. L'outil vous permettra également de télécharger les pièces jointes des services de fonctionnalités hébergés ArcGIS Online. J'espère que les utilisateurs trouveront cela utile et pratique.<\/P>
<\/P>
Mise à jour 10\/08\/17:<\/STRONG> L'outil téléchargera désormais les domaines de valeurs codées dans la géodatabase. De plus, consolidation des versions 2x et 3x en un seul outil. L'outil peut être exécuté depuis ArcGIS Pro ou ArcGIS Desktop.<\/P>Mise à jour 13\/11\/17: <\/STRONG>L'outil prend désormais en charge l'utilisation d'une clause where pour interroger le service.<\/P>Mise à jour 14\/03\/17:<\/STRONG> Mise à jour vers un script unique pour ArcMap\/Pro utilisant le module requests<\/P>Mise à jour 17\/01\/19:<\/STRONG> Merci à Adam Eversole<\/A> d'avoir signalé que la fonctionnalité de cet outil peut désormais être prise en charge par l'outil Feature Class to Feature Class<\/A> d'ArcGIS Pro :<\/P><\/P><\/BODY><\/HTML>
<\/P><\/BODY><\/HTML>
I have another ArcGIS script I need assistance with if you have time. Currently I have some editable features that our organization edits and uses on a daily basis. I’m wanting to create copies of these hosted feature services with the edit capabilities disabled for public maps I have setup. Do you know of a way with ArcGIS Python Api to do this? I would like the public layer to be updated on a daily basis.
You could create an application using Web AppBuilder for the public. As long as you don't add an Edit widget, they won't be able to edit.
If you're concerned about someone hacking the REST URL of your feature service, you can limit the usage of the service to a specific web map/application. See the section Limit Usage of Your Shared Service Item in the following link:
ArcGIS Server web services—ArcGIS Help | ArcGIS
My concern would be that the layer is still available to edit if somebody searched the feature layer through the arcgis website. I ended up finding the Create View Layer tool which would allow me to keep the editable layer private and also provide a version to the public that has no editing capabilities.
Hi Jake Skinner
When I tried to use the tool, I got the following error any idea about this.
Ps: I used this tool before and it was fine, but I tried to use it again and doesn’t work with me, may you please help in this.
Cheers,
Rawan
Rawan Saleh you may be using an older version of this tool. Can you try downloading the tool again and try to execute?
If you still receive the error, can you share the service you are trying to download to a Group in ArcGIS and invite my user account (jskinner_CountySandbox)?
Hi Jake Skinner ,
I use the latest version for this tool, and here the link for the services which I tried to download:
http://services.ga.gov.au/gis/rest/services/NEXIS_Building_Exposure/MapServer/7
I think the service is timing out. There are 581 records, but when trying to query this, it errors. The query is the following:
http://services.ga.gov.au/gis/rest/services/NEXIS_Building_Exposure/MapServer/7/query?where=objectid>0ANDobjectid<=581&outFields=*&returnGeometry=true&f=json&token=
Thanks for checking this, Do you have any idea about slovong this problem?
We are trying to use this tool to download feature service data from our secure portal environment, and we are getting the attached URL/login error.
I have triple checked the Username and Password (same as the login to the portal environment) and copied and pasted the service URL directly from the REST service location. Is there any other reason why we may be getting this error?
The feature service URL is https://geo.forsythco.com/server/rest/services/Hosted/StormGreenInfrastructure/FeatureServer/1
Thank you!
Rawan Saleh it looks like the query will work when there's less than 100 features queried. You would need to update the code so that it is downloading less than 100 features at a time.
Hi Jake Skinner - I have the script running without any errors, though I was curious if there was a way to assign a domains description instead of coded value.
I see in the updated on 8/10/17 you changed it to the coded value, could you possibly inform me on how to change that to the description instead?
Thanks a bunch, this tool is very useful
Running into an issue when executing the DownloadServicewithAttachments.py script from the IDE with hardcoded variables (rather than the toolbox). (we want to execute this via task scheduler is the reason why). This is the message that prints in the IDE interpreter window:
C:\Python27\ArcGISx6410.4\lib\site-packages\requests-2.6.0-py2.7.egg\requests\packages\urllib3\connectionpool.py:769: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning)C:\Python27\ArcGISx6410.4\lib\site-packages\requests-2.6.0-py2.7.egg\requests\packages\urllib3\connectionpool.py:769: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning)
Ever manage to resolve that issue? I get the same error using Desktop 10.6.
James Crandall add the following lines in the script under the import statements:
# Disable warningsrequests.packages.urllib3.disable_warnings()
Daniel Wade and Sean Redar I'll have to look into updating this code for federating environments. The url will change on how the token is generated (i.e. https://server.esri.com:7443/arcgis/sharing/rest/generateToken/ )
I am attempting to extract from our AGOL Organization account services directory (ex https://services3.arcgis.com/ ). I did change the token URL to our org which works with another python script against the services directory so its a little puzzling why this doesn't.
Sean Redar can you send a screen shot of how you have the tool setup?
Also, can you share the service to an AGOL Group and invite my user account (jskinner_Countybox). I can take a look at it.
Jake, I believe the request has been sent and permissions should be ok but with AGOL is always a bit of crap shoot. FYI, I could only find jskinner_CountySandbox.
Update, the tool did work when I supplied the URL of the Feature Layer versus the URL of the Feature Service (which also has a related table).
Sean Redar you will be able to download the features using the following URL:
https://services3.arcgis.com/aRSRPMqAe0fNWYeU/arcgis/rest/services/service_a5923f758eaa4817b1f34afebf7eca99/FeatureServer/0
And the associated table:
https://services3.arcgis.com/aRSRPMqAe0fNWYeU/arcgis/rest/services/service_a5923f758eaa4817b1f34afebf7eca99/FeatureServer/1
However, you won't be able to download the attachments in the table. There's an issue with REST API that will not grab attachments when they are coming from a table.
A workaround would be to use the ArcGIS API for Python. Here is a sample script that will download hosted feature service to a local zip file:
ArcGIS-Python-API-Samples/Backup Hosted Services.ipynb at master · jmirmelstein/ArcGIS-Python-API-Samples · GitHub
Thanks Jake, we will be able to accomplish what we need too with this additional information.
What do you recommend to do if the hosted FS has over 1gb of attachments?
We'd like to only pull down after a specific "CreateDate" but any modifications to the .py source we've attempted has failed due to issues with GlobalId values between the parent feature and child attachment.
James Crandall are you specifying a query within the script? Ex:
CreateDate > date '3/15/2018'
Correct. It seems that the feature service downloads the data with the query applied, but all of the attachments are being pulled down rather than only the related ones.
I could not reproduce this. The query definition only downloaded the related attachments. Could you share the service to an ArcGIS Group and invite my user account (jskinner_CountySandbox)?
Interesting. I'll take another look before bothering.
Im having an issue with bringing down a particular service:(https://utility.arcgis.com/usrsvcs/servers/793651fa1f2c48d29765d66b28ae1715/rest/services/Permits/DI_Permits/FeatureServer/0 ) that shoots me this error:
Traceback (most recent call last):
File "C:\Users\john\Documents\ArcGIS\DownloadService(COPY).py", line 185, in <module> data = response.json() File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\requests\models.py", line 892, in json return complexjson.loads(self.text, **kwargs) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\json\__init__.py", line 354, in loads return _default_decoder.decode(s) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\json\decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\json\decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from Nonejson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) Failed to execute (Test).
Ive used this tool for several other services and I cant figure out why this particular one is giving me this error
Yvan Sojdehei this appears to be the URL of a secure service that you've added to ArcGIS . Can you try the initial URL that you added as an item to ArcGIS ?
appreciate the tool you provde. however I always got error, I setup the service as not secure.
-------------------------------------------------------
Executing: DownloadService true false http://services1.arcgis.com/XpTq0H1nJ5DHgofs/arcgis/rest/services/service_2d983d48b0c8435897ca1481fe4389ec/FeatureServer # false false judyzhou@COH ***** C:\Data\VehicleTripInspection.gdb\test true C:\DataStart Time: Fri Oct 19 14:10:15 2018Running script DownloadService...
Generating Token
URL is incorrect. Or, Service is secure, please enter username and password.
Completed script DownloadService...Failed to execute (DownloadService).Failed at Fri Oct 19 14:10:16 2018 (Elapsed Time: 1.55 seconds)
Xiuju (Judy) Zhou you need to specify the index value of the service. Ex:
http://services1.arcgis.com/XpTq0H1nJ5DHgofs/arcgis/rest/services/service_2d983d48b0c8435897ca1481fe4389ec/FeatureServer/0
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.