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).
69
questions with no upvoted or accepted answers
3
votes
0
answers
1k
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
578
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
856
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
549
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
0
answers
141
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
0
answers
339
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
613
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
676
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
212
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
0
answers
237
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
993
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
68
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
48
views
Overwriting feature layer using lyrx file
I am trying to come up with a method that utilizes lyrx files to routinely overwrite a feature layer on ArcGIS Portal. I've tried a few methods that utilize Python scripts, ModelBuilder and Task ...
1
vote
0
answers
156
views
Extract list of content in a specific Portal webmap using ArcGIS API for Python
I would like to extract the lists of content (Feature & Map Image Service) including the type of base map. Also, wanted to know if all the layers are loading correctly using ArcGIS API for Python.
...
1
vote
0
answers
305
views
How to clone a copy using ArcGIS API for Python
What I am trying to do: Take a layer from ArcGIS Enterprise, clone it as a temporary file, overwrite a file in SQL DB, delete temporary file.
What I have tried so far:
def overwrite_existing_layer(...
1
vote
1
answer
247
views
ArcPy - overwrite feature service with CSV
I am trying to download a CSV from our project database, and then append this to a feature service in AGOL.
import os
import requests
import csv
import arcpy
from requests.auth import HTTPBasicAuth
...
1
vote
0
answers
119
views
Bypassing KeyError: 'type' when running a ArcGIS Online Python Notebook meant to overwrite organizational CSV
I have a scheduled organizational script that is only meant to be run during the summer and is left dormant for the winter as the data it scrapes is not maintained at that time. The reason I am ...
1
vote
0
answers
337
views
How to publish or replace the data to the feature layer hosted?
A little background: My teammate has created a hosted feature layer. I access the data of hosted feature layer using ArcGIS API for Python and pull the data.
The hosted feature layer he created doesn'...
1
vote
0
answers
249
views
ArcGIS Python API append new record
I am trying to insert a python dict record to the hosted online service.
I am getting the following error:
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\...
1
vote
1
answer
1k
views
Converting Pandas DataFrame to spatially enabled DataFrame geometry removes geometry In some cases
I want to convert my Pandas DataFrame with a WKT geometry column to a Spatially Enabled DataFrame (SEDF) and then into a featureclass in a geodatabase; however, sometimes the geometry column in the ...
1
vote
0
answers
517
views
Download of a file geodatabase failing when using script and query
I'm trying to download a file geodatabase using a script. The script is taken from the Esri documentation with minimal changes, basically I'm querying for the required feature layer appending date and ...
1
vote
0
answers
1k
views
How to query a specific layer from a feature service?
I am trying to get the list of feature service which has a specific layer (for example: River (the layer id is 0)) from a feature service,
from arcgis.gis import GIS
gis = GIS(url='https://pythonapi....
1
vote
0
answers
217
views
ArcGIS Python API - FeatureLayer set CRS
I'm loading a layer from ArcGIS with the ArcGIS Python API:
from arcgis.features import FeatureLayer
layer=FeatureLayer(lyr_url)
Then I make it a pandas dataframe and then move it to Geodataframe as ...
1
vote
0
answers
1k
views
Exporting FGDB From ArcGIS Enterprise using ArcGIS Python API
I am building a Python script for a client who wants a bunch of hosted feature services exported to file geodatabases. The script I've written works just fine. Each hosted feature service is exported ...
1
vote
0
answers
218
views
Accessing hosted feature layers in ArcGIS Portal
The feature layers can be accessed using the item type, is there any way to retrieve only the hosted feature layers from the Portal ??
from arcgis.gis import GIS
gis = GIS(url='https://pythonapi....
1
vote
0
answers
24
views
Non-editable Field names differ Between AGOL and File Geodatabase
While attempting to overwrite a hosted feature layer from a local featureclass, field.name "Shape__Length" cannot be updated using values from field.name "Shape_Length". When ...
1
vote
0
answers
322
views
Updating Portal Item Thumbnail ONLY if it is has not been changed yet using ArcGIS Python API
Using Python, is it possible to check if the thumbnail for a Portal Item is the default thumbnail? I want to update thumbnails if they have not been updated yet.
I know I can update thumbnails using ...
1
vote
0
answers
103
views
Removing rows limitation when making feature layer query using ArcGIS Python API
I have a fairly big spatiotemporal dataset located at a server, which gets additional 1000 rows every 10 seconds for like two moths already. I am concerned to download and process this data day by day,...
1
vote
0
answers
488
views
Script using Python API and Windows task scheduler
I have a Python script that uses the Python API to logging into the server, stop geocode services, rebuild locators and start services. I'm using task scheduler on a server machine where other Python ...
1
vote
0
answers
77
views
ArcGIS Python API - feature renderer faild in AGOL
I am trying to save a feature service in AGOL using ArcGIS Python API with symbols. I use the same symbols in a map widget and the features appear correctly but when I save the feature as a feature ...
1
vote
0
answers
340
views
Add empty layers to Feature Service with ArcGIS Python API
I would like to create a number of Feature Services. Each Feature Service should contain 15-20 layers. There is no data yet, as I would like to create these for data collection with ArcGIS Collector. ...
1
vote
1
answer
709
views
Cannot log in with different ArcGIS Portal user account using ArcGIS Python API
I have an ArcGIS Portal log in account (viewer account) in an enterprise GIS infrastructure and want to use the ArcGIS Python API to connect with a separate admin account to be able to produce reports ...
1
vote
1
answer
618
views
Importing/downloading symbology from ArcGIS Online using ArcPy?
I am currently attempting to create a script to download shapefiles from ArcGIS Online to my local drive before adding it to an aprx project and thereafter uploading it to a ArcGIS portal/enterprise.
...
1
vote
1
answer
667
views
AGOL Python Api - Modify Symbology of a Feature Layer
I want to modify the JSON properties of a Feature Layer hosted online to display a certain field in symbology. I am able to access the JSON properties, even the property itself but when I call an ....
1
vote
0
answers
160
views
Preserving data types when publishing to ArcGIS Online using ArcGIS Python API?
I have a Python script which does some data manipulation using Pandas dataframes, then outputs to CSV. The CSVs are then published to AGOL using the ArcGIS Python API, overwriting the existing ...
1
vote
0
answers
306
views
Uploading mxd to ArcGIS Online with Python?
I need to create a Python script to upload an MXD to AGOL. I have created an script in arcpy to create a service definition file (*.sd) from the mxd. I have not been able to upload the sd to AGOL ...
1
vote
0
answers
231
views
Finding closest feature to given address in ArcGIS API for Python?
I'd like to find the closest open space (i.e. a park, square, playground) from a City of Boston MapServer using Python's ArcGIS package.
I'd like to use arcgis.features.use_proximity.find_nearest() ...
1
vote
0
answers
226
views
Can ArcGIS Python API automate functionality provided in Web AppBuilder?
I was feeling adventurous the other day and I decided to dive into ArcGIS Pro and the new ArcGIS Python API. I watched some training videos and since I've been working with ArcGIS Online a lot, I ...
1
vote
0
answers
358
views
how to plot lat lon data to a map using jupyter notebook?
import arcgis
from arcgis.gis import GIS
from arcgis.features import SpatialDataFrame
ago_gis = GIS()
search_subset = ago_gis.content.search("Hong Kong Topographic Map")
subset_item = search_subset[...
1
vote
0
answers
246
views
Cannot plot map on ArcGIS python API?
I do not have ArcGIS desktop. And I have installed the ArcGIS Python API.
And I tried the following:
import arcgis
from arcgis.gis import GIS
from arcgis.mapping import WebMap
gis = GIS()
map1 = gis....
0
votes
0
answers
84
views
Error when connect to ArcGIS Server with Python API
I am working with ArcGIS Python API and trying to connect to a local server with the code:
gis = GIS(url="https://localhost:6443/arcgis", username="**", password="**", ...
0
votes
0
answers
46
views
clone_items() doesn't work with ArcGIS Enterprise Portal 11.1?
I just upgraded to ArcGIS Portal 11.1, and now clone_items() doesn't work. Here is an example:
item_id = 'f977c5ea26de465bb21c796dc7e5d95a'
item = source_gis.content.get(item_id)
cloned_items = ...
0
votes
0
answers
28
views
Using Python to identify Map objects used in Esri ArcGIS Enterprise Portal or AGOL Web Applications?
I'm trying to list the feature layers shown in each map from every web application, dashboard, and storymap on my Enterprise Portal. Is there a way to retrieve all the map objects that belong to an ...
0
votes
0
answers
25
views
How to detect cloud in time series Sentinel using ArcGIS Pro and Python
This is my code:
import arcpy
from datetime import datetime
from arcgis.gis import GIS
from arcgis.raster import ImageryLayer
# Connect to GIS (with authentication)
gis = GIS("https://www.arcgis....
0
votes
1
answer
86
views
How to return subtype and domain description instead of the code, when using arcgis.gis Python
I am working on some Python that takes an attribute table and makes a pandas df from it. I am doing this by creating an empty list, and looping through each record of the attribute table and making a ...
0
votes
0
answers
28
views
Can't get Python to publish .csv to ArcGIS Portal
I built and published an address locator so it could be available as a geocoding service on our internal ArcGIS enterprise Portal. I now want to build a tool in Python that can be published as a ...
0
votes
1
answer
118
views
Overwriting hosted table in ArcGIS Online with CSV file from Pandas dataframe in Python
I have a script that I'm using to sort through a very large feature layer with thousands of records and create a summary table of them by type. It also calculates the count of records of the last 5 ...
0
votes
1
answer
31
views
ArcGIS API for Python WebMap object move_to_basemap() method will not move the layer to the basemap
ArcGIS API for Python version 2.2.0.1
I have used the move_from_basemap() to move basemap to a layer.
from arcgis.gis import GIS
from arcgis.mapping import WebMap
## Access AGOL
agol = GIS("home&...
0
votes
1
answer
22
views
Accessing the UserInvitationManager class, ArcGIS Python API
How do I use the UserInvitationManager class with the ArcGIS Python API?
The documentation is scant and there are no examples.
I have a workflow that will involve inviting a separate account of mine ...
0
votes
0
answers
32
views
Reducing processing time reading spatial data
I have a feature class I wanted to read as a Spatially enabled dataframe:
from arcgis.features import GeoAcessor
df_teig = GeoAccessor.from_featureclass(feature_class_path)
The dataframe has 17 ...