Questions tagged [arcgis-python-api]
ArcGIS API for Python is a Python library for working with maps and geospatial data, powered by web GIS (ArcGIS Online, ArcGIS Enterprise portal).
154
questions
10
votes
1
answer
4k
views
Replacing ArcPy with ArcGIS API for Python?
Today I found out about the ArcGIS API for Python. I was wondering if you could use this to (eventually) replace ArcPy?
Recently I have been doing analyses that require cloud based solutions. When ...
7
votes
2
answers
4k
views
Using the arcpy Python library with hosted feature service layers from ArcGIS Online?
Is it possible to use the arcpy library with hosted feature service layers from ArcGIS Online?
I am aware of the ArcGIS API for Python, but the API lacks many of arcpy's features.
In my case, I'd ...
6
votes
2
answers
6k
views
How to update a hosted feature service on ArcGIS Online using the Python API for ArcGIS Pro?
I'm trying to follow the steps in the Esri blog post Updating your hosted feature services with ArcGIS Pro and the ArcGIS API for Python but am running into an error.
To test this I published a ...
5
votes
2
answers
956
views
Enable Popups for each layer in webmap using ArcGIS API for Python
I am looking to use the ArcGIS API for Python to enable popups for each layer in a webmap.
I found Configure Popup Attributes Programmatically with ArcGIS API for Python on GeoNet which addresses how ...
4
votes
3
answers
699
views
Installing ArcGIS Python API with ArcGIS Pro
I am new to the world of ArcGIS and I come from a data science background. I recently installed ArcGIS Pro with a Single User license from my organization. I would like to use it with the Python API ...
4
votes
1
answer
2k
views
Export ArcGIS spatially enabled dataframe to feature class
I'm working to develop a tool that converts JSON data pulled from an API into a feature class to be stored in an ESRI file geodatabase. I'm currently testing the functionality in a Jupyter notebook ...
4
votes
1
answer
2k
views
Overwriting Feature Layer on ArcGIS Online using ArcGIS Python API
I get a generic error "Job Failed" when using the below code to try and overwrite a feature layer on ArcGIS Online:
shp_fp = 'E:\folder\shapefile.shp'
feat_id = 'q3p094rupqe9vntowe98w98eyt0w'...
4
votes
1
answer
1k
views
Update field properties of a layer definition with ArcGis Python API
We have a fields in a large amount of AGOL hosted feature layers that we want to make un-editable and others that we do not want visible.
Rather than going into the service definition for each and ...
3
votes
3
answers
3k
views
Convert ArcGIS Spatially Enabled Dataframe to Geopandas GeoDataFrame
I have some code that works on geopandas GeoDataFrames but due to a client requirement I suddenly have to access my input data via the ArcGIS Python library, which only allows me to access the data as ...
3
votes
2
answers
1k
views
Programmatically determining version of ArcGIS API for Python?
I would like to obtain the version of ArcGIS API for Python for logging/diagnostic purposes.
Is there a way to determine this before a connection is made?
I know that once I have the GIS object, I ...
3
votes
1
answer
1k
views
Upload GeoJSON files to ArcGIS Online content
I would like to upload local GeoJSON files with Python automatically to ArcGIS Online. Now I have to upload them one for one, which takes quite some time. So I looked into the ArcGIS API for Python.
I ...
3
votes
1
answer
51
views
Area calculation in "Thomas Fire analysis"
I am studying this notebook: California wildfires 2017 - Thomas Fire analysis
I can follow the first part of the notebook. But I have got confused in this cell to calculate the burnt area:
ext = {&...
3
votes
1
answer
5k
views
Updating hosted feature layers on AGOL using the ArcGIS Python API?
I previously asked Adding data to a feature layer on ArcGIS Online using arcrest and arcresthelper.featureservicetools? regarding the most current process for establishing and then automating feature ...
3
votes
1
answer
1k
views
Using ArcPy and ArcGIS API for Python together?
I am having trouble with how I am supposed to use both ArcPy and ArcGIS API for Python. ArcPy is only in Python 2 and ArcGIS API for Python is in ArcGIS Pro and is Python 3. I don't know how to set my ...
3
votes
1
answer
236
views
Using ArcPy to retrieve maps posted on an ArcGIS portal?
I'm using ArcPy and python 3.5 to connect to a few different instances of ArcGIS portal.
The goal is to produce a report listing the maps, layers, and datasources that each portal instance has to ...
3
votes
2
answers
603
views
Downloading ArcGIS Online feature service using ArcGIS Python API
I rarely use ArcGIS Online but I have been tasked to download all layers on this https://services5.arcgis.com/gFh7gtZrHd449arT/arcgis/rest/services/greenez514_SW5_District_Layers/FeatureServer
I found ...
3
votes
0
answers
884
views
Mapping .csv file using ArcGIS online with Python
I have .csv data in the format:
Longitude Latitude Threat
-24 45 0.5
-31 40 0.9
. . .
. . .
I want to visualize this data as a threat ...
3
votes
1
answer
395
views
IndexError: list index out of range - item report ArcGIS API for Python
I'm quite new to Python and ArcGIS API for Python.
I'm trying to create a report of all the items owned by one of my ArcGIS online organization user.
For each item owned by the user I want to record ...
3
votes
2
answers
567
views
What is the correct syntax for the item.publish command to update a hosted feature layer?
Trying to use the code provided at the bottom of this entry
overwrite feature class in arcgis online using python
to overwrite an existing hosted feature layer in my ArcGIS Online content.
I have ...
3
votes
0
answers
411
views
ArcGIS API for Python not plotting Spatially Enabled Dataframe
I'm using Python 3.6.8, Pandas 0.25.3, and ArcGIS API for Python 1.6.2. I'm pulling data from an API and viewing it in a pandas dataframe using a Jupyter Notebook. The data has several attributes ...
2
votes
3
answers
2k
views
Getting all users in ArcGIS Online organization?
I want to return a list of all users in my ArcGIS Online (AGOL) organization. However, the result returned in gis.users.search() appears limited to 100 users.
Is there any way to return all users or ...
2
votes
1
answer
301
views
Reverse geocoding for multiple coordinates using ArcGIS API
My code is generating coordinates (Lat, Lon) of 1000 houses. Now I want to reverse these 1000 coordinates to get the full address. The code is:
import pprint
from arcgis.geocoding import ...
2
votes
2
answers
3k
views
How to search the folder's items in ArcGIS Online using the ArcGIS API for Python
I want to have a list of the items inside a folder created by my user in AGOL, I want to use the ArcGIS API for Python.
so far I have found this:
import sys
from arcgis import gis
import os
...
2
votes
1
answer
528
views
Using ArcGIS Python API to consume standalone ArcGIS REST API
I have access to a ArcGIS REST API service running on a standalone, unfederated ArcGIS Server. (Not AGOL or ArcGIS Enteprise) ie (https://xxxx.xxxxx.com/arcgis/rest/services/xxxxxx/xxxxMap/MapServer)
...
2
votes
1
answer
764
views
How can I use UpdateCursor in AGOL layers?
I'm all new to Python, and 'Im stuck with a problem:
Is it possible to use UpdateCursor on Feature Layers in AGOL?
I am trying something like this:
from arcgis.gis import GIS
gis = GIS("https://...
2
votes
1
answer
866
views
Adding data using Python from ArcGIS Online/ArcGIS REST Services directory to a ArcMap MXD
I want to update over 100 MXDs by adding 4/5 ArcGIS Online/ArcGIS REST Services directory layers. I am unsure whether this is possible using Python and can only find documentation on how to access ...
2
votes
1
answer
3k
views
No module named 'arcgis' for import GIS
I have ArcGIS API for Python installed and when I use below line, am getting error as
ModuleNotFoundError: No module named arcgis
from arcgis.gis import GIS
Please refer to Image
2
votes
2
answers
1k
views
Copying feature service to local geodatabase using ArcPy and ArcGIS API for Python?
I am trying to export/copy a feature service to a local geodatabase where I can work on it locally.
I have provided the code below. I keep getting an "Object: Error in executing tool" for the last ...
2
votes
2
answers
1k
views
ArcGIS API for Python: Parameter Invalid - Item with the same key has already been added
I'm trying to update an ArcGIS Online (AGOL) feature layer using an updated local CSV file (the steps for this process are detailed in this Sample Notebook). I am using Jupyter Notebook to handle all ...
2
votes
1
answer
234
views
Displaying 3rd party FeatureSet geometries on jupyter notebook webmap using ArcGIS Python API
How can I add all geometries included in a FeatureSet to a web map?
Trying to add geometries (i.e., shapes) to a Jupyter notebook web map (see code sample below).
Adding features from the ArcGIS ...
2
votes
1
answer
295
views
Creating Tile Service in ArcGIS Online Python API
I'm trying to create a tile layer via the ArcGIS API for Python. When creating a tile layer in AGOL (manually) they have you specify a range of scales for the zoom level (e.g. 1:1000 or 1:4000).
...
2
votes
2
answers
442
views
Updated JSON not showing up in feature layer properties on ArcGIS Online
I wrote a script that will automate the overwrite feature layer process using a map object in ArcGIS Pro. When changes are made to the underlying data they show up on AGOL after running the script. ...
2
votes
1
answer
881
views
How to include maps in Jupyter notebook HTML export?
I'm running the 1.4.2 version of the ArcGIS Python API. In a Jupyter Notebook, I create a map like:
lowes = "Arkansas USA Lowe's"
lowes_map = gis.map("AR, US", 6)
lowes_map
...and get my output. I ...
2
votes
0
answers
309
views
Download data from Portal using ArcPy
I am trying to download a hosted layer from our portal and save to a file geodatabase.
Following Using ArcPy to copy a portal feature service to a fgdb feature class:
I've tried:
from arcgis.gis ...
2
votes
0
answers
107
views
Get the list of Feature layer which contains a specific layer
I am trying to get the list of Feature layers which contains the specific layer named WETTBEWERBER in my portal, the code runs fine but there is no results printed out,
What am I doing wrong here?
...
2
votes
1
answer
316
views
Putting shapefile on map in ArcGIS Online using ArcGIS Python API and Jupyter Notebook
I inserted a shapefile (in .zip as required) to ArcGIS Online through Jupyter notebook:
from arcgis.gis import GIS
my_gis = GIS()
m = my_gis.map()
#let's put the shape file to AGOL
shp_item = my_gis....
2
votes
0
answers
268
views
ArcGIS API for Python: AttributeError: module 'brotli' has no attribute 'error'
from arcgis.gis import GIS
when run in ArcGIS Pro 2.6 notebook results in long error message (below).
What might be wrong?
Note that import arcpy works without difficulties.
--------------------------...
2
votes
0
answers
534
views
arcgis to_featurelayer() crashes kernel with ImportError: PyCapsule_Import could not import module "datetime" [closed]
My python kernel and ArcGIS both crash when I try to export a spatially enabled DataFrame to a featurelayer or featureclass in one of my virtual environments.
In addition to the python and ArcGIS ...
2
votes
0
answers
467
views
Connecting Python to get data from Survey123 and show it on Web AppBuilder
I am downloading a survey data from survey123.com by using GIS services however I am not able to create a widget on webapp to show it on ArcGIS webapp. I am not familiar with ArcGIS but here is the ...
2
votes
1
answer
499
views
Creating new Feature Layer from existing feature layer on ArcGIS Online using ArcGIS API for Python
I have a folder on ArcGIS Online for a city that has few layers in it.
I need to create separate folders for each city and then create new feature layers using these existing layers, preferably using ...
2
votes
1
answer
135
views
How to get the job status of gis.item.export or make it execute synchronously?
I'm using the ArcGIS API for Python to export a feature service to a FGDB and then download it.
My problem is that the export function appears to be asynchronous even though I set wait=True.
The ...
2
votes
1
answer
7k
views
TypeError: cannot unpack non-iterable NoneType object on Spatial Join
I'm working with two spatial dataframes and am trying to do a spatial join on the two.
parcels_sdf -- a frame with around ~370,000 real estate parcels.
subdivisions_sdf -- a frame with all ...
2
votes
0
answers
199
views
Change Dashboard's map with ArcGIS Python API
Is it possible to change the map used in a Dashboard with the ArcGIS Python API?
I know it can be done manually by changing the map's id in the ArcGIS Online Assistant, but I would like to do this ...
2
votes
1
answer
295
views
How to populate an item's tables list for a ArcGIS API for Python Map Service Item?
I am trying to obtain a specific table from a Map Service item, however the table list is empty. The layers list correctly reports back 5 layers.
My code snippet below:
search_result = gis....
2
votes
1
answer
789
views
Batch uploading PDF files to ArcGIS Online?
I am trying to upload multiple pdf files to ArcGIS Online content all at once.
Is there is a script that I can use to add content to ArcGIS Online?
2
votes
0
answers
58
views
Function execution hangs if connection to Internet is lost
I am trying to update feature layer. I am updating the records in a loop.
The problem is in the case Internet connection lost. It get stuck in the edit_features() function. I have to ctrl+c to stop ...
1
vote
1
answer
3k
views
Publish file geodatabase to ArcGIS Online using ArcGIS API for Python
I am reading in the documentation it should be possible to publish a local file geodatabase as a hosted feature layer to ArcGIS Online. I have been trying different things, but that job keeps failing. ...
1
vote
1
answer
184
views
Does ArcGIS API for Python use ArcPy internally?
Today I read a GIS SE user opinion in Using Geometry.distance_to() in ArcGIS API for Python that:
it appears that ArcGIS API for Python uses ArcPy internally
This surprised me because I do not ...
1
vote
1
answer
5k
views
Difference between ArcPy and ArcGIS API for Python? [duplicate]
Could someone explain, from a high level overview, the difference between ArcPy and the new ArcGIS API package in Python?
1
vote
2
answers
1k
views
Extract domain from ArcGIS Online feature service using Python API
I have a feature service with several coded value domains that I'm accessing as a spatially enabled dataframe using the python API.
As far as I can tell, the dataframe only holds the code for each ...