22 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 ...
user avatar
  • 63.8k
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 ...
user avatar
  • 847
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: ...
user avatar
  • 52.8k
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 ...
user avatar
  • 15.4k
5 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 ...
user avatar
  • 141
4 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 ...
user avatar
  • 1,692
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 ...
user avatar
  • 41
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 ...
user avatar
  • 1,976
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 ...
user avatar
  • 2,084
3 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://...
user avatar
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 ...
user avatar
  • 15.4k
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 ...
user avatar
  • 1,468
3 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 = ...
user avatar
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....
user avatar
  • 1,747
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....
user avatar
  • 1,574
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 ...
user avatar
  • 847
2 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 ...
user avatar
  • 15.4k
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 ...
user avatar
  • 83
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[...
user avatar
  • 36
2 votes
Accepted

Extract domain from ArcGIS Online feature service using Python API

I am not aware of a functionality in the ArcGIS API for Python to accomplish this. However, you can do a workaround and get the values by querying the domains of the feature service using the ArcGIS ...
user avatar
2 votes
Accepted

Using Geometry.distance_to() in ArcGIS API for Python

I have a vague memory of reading somewhere that the distance to only does euclidean distances, but I can't find a reference to it. Also you might actually try using PointGeometry, which accepts the ...
user avatar
  • 1,846
2 votes
Accepted

No module named 'arcgis' for import GIS

When using PyScripter with arcgis pro you should call the IDE with a batch script, to activate the anaconda environment. There are batch files shipped with arcgis pro which i use to call PyScripter: @...
user avatar
2 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(&...
user avatar
  • 698
2 votes

Adding data using Python from ArcGIS Online/ArcGIS REST Services directory to a ArcMap MXD

The only way to add a layer using Python/arcpy to ArcMap is using the arcpy.mapping.AddLayer function. This function works with mapping layers. No matter what you do in the ArcGIS for Python API, you'...
user avatar
  • 15.4k
2 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'...
user avatar
  • 15.4k
2 votes
Accepted

Adding query layer to MapView in Jupyter Notebook returns "RuntimeError: Cannot infer layer: will not be added to map"

You're running into the same problem/answer here: Adding data using Python from ArcGIS Online/ArcGIS REST Services directory to a ArcMap MXD --just reversing the layers and the map technology. You're ...
user avatar
  • 15.4k
2 votes
Accepted

Upload raster data using ArcGIS API for Python?

You can upload hosted tiled layers to AGOL which consist of images in a tile package. The process for doing this is different than uploading content such as the formats you mentioned. This ...
user avatar
  • 1,550
2 votes
Accepted

Is ArcGIS API for Python or ArcREST faster than arcpy.da for editing hosted features?

As your code is now, you're doing a row-by-row update. This means the code needs to send 52,000 requests and get 52,000 responses -- at a minimum. As Vince points out in the comment, this is a quick ...
user avatar
  • 15.4k
2 votes

Upload shapefiles to ArcGIS Online using Python script on computer without ArcGIS Pro installation

It seems likely your code requires the ArcGIS Python API. (This is included with ArcGIS Pro's Python). As long as your code does not require anything arcpy, you can migrate your code and workflow to a ...
user avatar
  • 15.4k

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