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
Take a look at the ArcGIS Python API
The general link
ArcGIS API for Python | ArcGIS for Developers
and the api link
API Reference for the ArcGIS API for Python — arcgis 1.8.4 documentation
Have you seen these?
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
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"")
@DavinWalker2 Hi,
I am using the above code:
import random
import numpy as np
import sys
from arcgis.gis import GIS
gis = GIS("https://www.arcgis.com", "zak100", "**************")
but I am getting the error:
from arcgis.gis import GIS
ModuleNotFoundError: No module named 'arcgis'
Somebody please guide me.
Zulfi.
@zak100 wrote:I am using the above code:
import random
import numpy as np
import sysfrom arcgis.gis import GIS
gis = GIS("https://www.arcgis.com", "zak100", "**********")
but I am getting the error:
from arcgis.gis import GIS
ModuleNotFoundError: No module named 'arcgis'
You need to install arcgis - the ArcGIS API for Python
@zak100 Note if that is was actually your arcgis.com password (now changed by a mod), I suggest you change it immediately.