Connecting to ArcGIS online with arcpy in pycharm

543
4
02-10-2021 06:47 AM
Labels (2)
NikolajKlausen
New Contributor II

Dear all,

I am interested in making a python script that reads data from Arcgis Online using ArcPy, but I haven't been able to find much information on the net.

I belong to an organisation that has a ArcGIS Online server.

I am following the udemy course "ArcPy for Python Developers using ArcGIS Pro", but as far as I can tell there is no point where the course covers accessing ArcGIS Online through arcpy.

Is there anyone that might be able to push me in the right direction?

Thank you very much in advance,

Nikolaj

 

 

 

0 Kudos
4 Replies
JoeBorgione
MVP Esteemed Contributor

Take a look at the ArcGIS Python API

That should just about do it....
0 Kudos
DanPatterson
MVP Esteemed Contributor
0 Kudos
StuartMoore
Occasional Contributor III

you can also use the RestAPI on your feature service to query it, have a look at this:

https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm

i have some python scripts i run using the endpoints and you dont need to have ArcPy installed either just python and i use http requests

Stu

0 Kudos
DavinWalker2
Esri Contributor

Hi Nikolaj,

As mentioned you can connect to ArcGIS Online through the ArcGIS API for Python.

The below is how to establish a connection to ArcGIS online.

from arcgis.gis import GIS
gis = GIS("https://www.arcgis.com", "UserName", "P@ssword123"")