Skip to main content
25 votes

Replacing ArcPy with ArcGIS API for Python?

From Overview of the ArcGIS API for Python: The ArcGIS API for Python is implemented using the online and on-premises web GIS platform provided by ArcGIS Online and ArcGIS Enterprise ...
PolyGeo's user avatar
  • 65.4k
8 votes
Accepted

Convert ArcGIS Spatially Enabled Dataframe to Geopandas GeoDataFrame

While there is no method in the ArcGIS Python API to convert from a SpatialDataFrame to a Geopandas GeoDataFrame, we can create a GeoDataFrame using another method. I will assume you are accessing ...
Whiskers's user avatar
  • 191
7 votes
Accepted

Programmatically determining version of ArcGIS API for Python?

Update based on OP's comment: To get the version of the ArcGIS API for Python package, the following snippet should work without first establishing a connection: import arcgis arcgis.__version__ on ...
PhilippNagel's user avatar
  • 1,720
6 votes
Accepted

Upload GeoJSON files to ArcGIS Online content

This Esri Community question contains the answer. To summarize (since the final solution is spread out over multiple answers): from arcgis.gis import GIS data_path = r'C:\path\example.geojson' gis = ...
sandeman_13's user avatar
6 votes
Accepted

How to get description instead of coded value for a field with domain in hosted feature layer

Use the ArcGIS for Python API from arcgis.gis import GIS ## or use GIS("agol_url", "username", "password") agol = GIS("home") item = agol.content.get("...
Clubdebambos's user avatar
  • 1,745
5 votes
Accepted

Difference between ArcPy and ArcGIS API for Python?

arcpy is installed with ArcGIS software and requires a license to use. It is meant to assist in automating complex GIS tasks and extending GIS functionality not available out of the box. It is still ...
Brad's user avatar
  • 855
5 votes
Accepted

Does ArcGIS API for Python use ArcPy internally?

Yes the ArcGIS API for Python can use the arcpy package if it is available in the current environment. arcpy is not required, but enables some additional functionality if available. For example: ...
user2856's user avatar
  • 69.6k
5 votes

Publish file geodatabase to ArcGIS Online using ArcGIS API for Python

Your code is close, but there are a few things you're doing wrong with the properties you're passing into each call. Try the below code (specifically updating what you're passing for the properties ...
KHibma's user avatar
  • 17k
5 votes

Installing ArcGIS Python API with ArcGIS Pro

For using ArcGIS API for Python, credentials have to be provided gis = GIS("http://www.arcgis.com", "username", "password"). from arcgis.gis import GIS gis = GIS("http://www.arcgis.com", "***", "***"...
Taras's user avatar
  • 34k
4 votes

How to update a hosted feature service on ArcGIS Online using the Python API for ArcGIS Pro?

I had this problem due to changing the source name in the map doc after publishing the service. Thus, the source name in the service was different from the source name in the map doc. I had to look at ...
user138720's user avatar
4 votes
Accepted

Updating hosted feature layers on AGOL using the ArcGIS Python API?

After a few weeks getting up to speed on the ArcGIS Python API, I have come up with work flow that works quite well. My original understanding of scripting using JSON dictionaries was a bit off as ...
GeoJohn's user avatar
  • 1,996
4 votes
Accepted

Using the arcpy Python library with hosted feature service layers from ArcGIS Online?

Using ArcGIS Pro 2.5 and making sure my feature service was editable with update privileges I was able to get the following line of code to work: arcpy.management.AddGeometryAttributes("https://...
Alan Coyle's user avatar
4 votes

Getting all users in ArcGIS Online organization?

Try using the UserManager with the Python API. The UserManager has an option for max_records which can be set to the number of users in your group from arcgis.gis import GIS import arcgis gis = GIS(&...
F_Kellner's user avatar
  • 748
4 votes
Accepted

Area calculation in "Thomas Fire analysis"

It looks like 1200 and 450 are the dimension of the image in pixels, so the image is 1200 pixels wide by 450 pixels tall. The extent (first line of the cell) is in Web Mercator coordinates, so the ...
ycartwhelen's user avatar
  • 2,476
3 votes

Using ArcPy and ArcGIS API for Python together?

You can only run a Python script against one version of the Python debugger at a time (2.7, 3.4, etc). If you have ArcMap, which runs against Python 2.x and the Python API (I'd assume you've ...
KHibma's user avatar
  • 17k
3 votes
Accepted

Adding hosted Feature Layer from AGOL to my local ArcGIS Pro through Python

This worked for me: aprx = arcpy.mpArcGISProject("CURRENT") m = aprx.listMaps("Map")[0] itemid = '2ec9f27bea254a428e4eb70e7650672d' m.addDataFromPath("https://mycounty.maps.arcgis.com/home/item.html?...
alexGIS's user avatar
  • 1,445
3 votes
Accepted

Reverse geocoding for multiple coordinates using ArcGIS API

Your error was probably similar to this one Traceback (most recent call last): File "D:/test.py", line 24, in <module> results = reverse_geocode(pt) File "C:\...\...
Taras's user avatar
  • 34k
3 votes

Installing ArcGIS Python API with ArcGIS Pro

The answer from @Taras is correct in how you can authenticate and startup the GIS object within the ArcGIS Python API -- there is, however, many ways to get started. See the Working with different ...
KHibma's user avatar
  • 17k
3 votes

How can I use UpdateCursor in AGOL layers?

The error is saying the UpdateCursor does not like the input, it is NOT a "table or featureclass". If you do a type on your layers, you'll see its an object specific to the ArcGIS Python API. And you'...
KHibma's user avatar
  • 17k
3 votes

Enable Popups for each layer in webmap using ArcGIS API for Python

I made a simple web map to test this out. For some reason none of my layers had the 'popupInfo' property mentioned in that geonet post ... but setting the 'disablePopup' property to false on all ...
Nick's user avatar
  • 1,623
3 votes
Accepted

How to append a FeatureCollection to a hosted Feature Layer in ArcGIS Enterprise?

The documentation around this API is pretty sparse, so I disovered this through a lot of trial+error. While the FeatureLayer page says that it expects to receive a "FeatureSet or List" as ...
Stephen Lead's user avatar
  • 21.2k
3 votes
Accepted

Access ArcGIS Python environment, installed via in Anaconda Navigator, from .bat script in normal cmd window?

If you do not have ArcGIS Pro currently installed on your machine If you installed the arcgis library through conda but do not have ArcGIS Pro installed on yout machine, you need to call the activate....
Felipe D.'s user avatar
  • 2,749
3 votes
Accepted

How to access layer using feature service URL/path

from arcgis.gis import GIS from arcgis.features import FeatureLayer agol = GIS("home") url = "https://maps.portaladdress.com/arcgis/rest/services/Hosted/Feature_layer/FeatureServer/0&...
Clubdebambos's user avatar
  • 1,745
2 votes
Accepted

Using ArcPy to retrieve maps posted on an ArcGIS portal?

With the ArcGIS Python API from the help The output of this is a dictionary of all items (source_items_by_id). Do with them as you wish: from arcgis.gis import GIS source = GIS("https://host.esri....
Ben S Nadler's user avatar
  • 1,604
2 votes
Accepted

Creating Tile Service in ArcGIS Online Python API

Yes, 1000.0000 is how you would specify a 1:1000 scale when creating a cached tile service. I use 1:1155581.108577 as my greatest scale and the parameter I pass is 1155581.108577. Also, a tiled ...
Brad's user avatar
  • 855
2 votes

Displaying 3rd party FeatureSet geometries on jupyter notebook webmap using ArcGIS Python API

So with quite a bit more digging around in the sample notebooks provided by ESRI, I found the map.draw method. It can take both features and featuresets and draw their shapes onto a web map. The only ...
Adestin's user avatar
  • 83
2 votes

Update field properties of a layer definition with ArcGis Python API

Hosted Feature Layers do not have a 'visible' property according to the REST API. Here are the properties you should expect to see at 10.6.1: "fields" : [ { "name": "<fieldName1>", "type": "&...
psl's user avatar
  • 336
2 votes
Accepted

How to search the folder's items in ArcGIS Online using the ArcGIS API for Python

what if you add this: me = source.users.me me.folders for folder in me.folders: print(folder['title']) me.items(folder['title']) itemsInFolders = me.items(folder=f[...
Dominic's user avatar
  • 36
2 votes

Programmatically determining version of ArcGIS API for Python?

The following code is working perfectly for me. import pkg_resources dists = [d for d in pkg_resources.working_set] for el in dists: if "arcgis" in str(el): arcVersion=str(el).split(" ")[...
Raskar Kapak's user avatar
2 votes
Accepted

Copying feature service to local geodatabase using ArcPy and ArcGIS API for Python?

So I figured it out. The issue I was having is that I wasn't referencing down all the way to the REST API URL. Once you give it the feature service URL page to your feature service then it works fine. ...
P. Shutler's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible