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).

Filter by
Sorted by
Tagged with
1 vote
1 answer
643 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 ...
2 votes
1 answer
941 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?
0 votes
1 answer
466 views

List all maps in my Portal and list their corresponding layers

I am trying to list all of the maps inside of my Portal with the corresponding features that are inside. So far this is my code: # Import necessary modules import arcgis import openpyxl # Create an ...
2 votes
1 answer
177 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 ...
0 votes
0 answers
40 views

Hosted layer in ArcGIS not getting updated

I'm encountering a peculiar issue while trying to add records to a Hosted Layer in ArcGIS using Python. I am using ArcGIS Pro 3.1.3 with ArcGIS Enterprise 11.1. I am running this code from the Jupyter ...
2 votes
3 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 ...
3 votes
2 answers
755 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 ...
0 votes
1 answer
694 views

Generating Queried CSV from shapefile using ArcGIS API for Python?

I'm trying to create a csv from a query of a feature layer hosted in ArcGIS Online. The csv only needs to contain one field, where the query is met, geometry is not needed. I'm having issues getting ...
0 votes
1 answer
55 views

df.spatial.to_featureclass produces an empty shapefile [closed]

I am using ArcGIS Pro 2.9.8 and Python 3.7 from the ArcGIS\PRO\bin\Python\envs\arcgis-pro-py3\python.exe. I have a pandas dataframe from CSV I am trying to get to a shapefile or featureclass for a set ...
0 votes
1 answer
355 views

Return URL of a query on a feature layer using arcgis API

I am familiarizing myself with the arcgis API for Python, and I would like to view the query I perform on a feature layer as a URL: from arcgis.features import FeatureLayer from arcgis.geometry ...
0 votes
1 answer
21 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&...
4 votes
2 answers
3k 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 ...
3 votes
1 answer
521 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
1 answer
447 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 ...
0 votes
1 answer
177 views

Access user calling a web tool

I am currently developing a GP Tool / WebTool for ArcGIS Enterprise. Main goal of the tool is to write what3word tags to point features. Workflow is as follows: User selects a layer in the webmap Run ...
0 votes
1 answer
13 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
1 answer
28 views

Issue with attribute types when publishing GeoJSON to ArcGIS Online

I'm trying to publish a GeoJSON file containing lines and points to ArcGIS Online. The publication process is successful, resulting in a Feature Layer with two layers - point and line. Everything ...
2 votes
1 answer
617 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 ...
0 votes
0 answers
18 views

Setting/Un-Setting Service Lock Database Schema Property Using ArcGIS API for Python

Is there a way to set/unset a service Lock Database Schema using ArcGIS ArcGIS API for Python?
2 votes
4 answers
3k 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 ...
1 vote
1 answer
178 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 ...
0 votes
0 answers
31 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 ...
0 votes
1 answer
35 views

Create a new GPFeatureLayer from data frame

I am a complete newbie to ArcGIS/ArcPy. I am creating a new Python Toolbox, that reads in a GPFeatureLayer, and also should return one. I read in the values of a GPFeatureLayer row by row. Then I ...
0 votes
2 answers
570 views

Filtering by folder or authoritative maps when using gis.content.search

I use the code in Python for item in gis.content.search(query="owner:MyUsername", item_type='Feature Service') to go over the feature classes uploaded on my organization's AGOL page. I want ...
0 votes
1 answer
407 views

ArcGIS API for Python: SEDF from_layer Fails With 'Layer' object has no attribute 'filter'

I'm struggling to build a dataframe out of a featureclass (via a layer), where I'm getting this error message: Exception: Could not load the dataset: 'Layer' object has no attribute 'filter' from ...
1 vote
1 answer
534 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
911 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 ...
2 votes
1 answer
92 views

How to access layer using feature service URL/path

I am trying to access a feature layer within my Portal using the layers path. I have been accessing the data within Visual Studio Code using the feature layers ID like this: feature_service_layer = ...
0 votes
1 answer
23 views

Handling/troubleshooting errors with helper scripts in arcgis module

I am fairly new to python and need recommendations on how to handle internal/helper function failures. I have a script that that imports a list of jurisdictions, then iterates through that list and ...
1 vote
1 answer
86 views

Accessing ArcGIS Portal user account using ArcGIS API for Python

Using ArcGIS API for Python on Portal, I need to see from arcgis.gis import GIS gis = GIS(url="https://xxx.xxx.com/portal", username="xxx", password="xxx") print(gis....
-1 votes
1 answer
95 views

GeoAccessor (SEDF) spatial join is not working in ArcGIS Python API?

I want make a spatial join with my two spatially enabled dataframes. But while doing a join between the two dataframes. I got below errors. joined_sedf = sedf_cables.spatial.join(sedf_sub_assignment[['...
0 votes
0 answers
20 views

"User does not have administer or publishing privileges to item" error while publishing a multipart item in ArcGIS

I am trying to publish a new item using multipart. Sometimes, our geojson files were too big, so we need to use multipart. If I add only 1 part, it works fine. If I add more than 1 part I get an error:...
0 votes
1 answer
145 views

How do I get the data from HostedFeatureLayer for today's date using Python from ArcGIS Online

Currently, I am pulling all the data from the featurelayerid using the below script: feature_layer_id = ' ' Inspform = gis.content.get(feature_layer_id) insp=Inspform.layers[0].query().sdf insp....
0 votes
0 answers
45 views

While converting feature class to spatially enabled dataframe shape_length data is not populating

I am converting feature class to spatially enabled data frame using below code, after conversion shape_length field of a line layer is not getting populated. Only shape data is available. Why this is ...
0 votes
1 answer
102 views

ArcGIS Python API (gis.user.search)

Every time I run this code with a wild card (max_users = '*') or >140 I get this error JSONDecodeError: Expecting value: line 1 column 1 (char 0). But are <140 value it works fine not just all ...
1 vote
1 answer
510 views

Why is the arcgis.geometry.buffer method failing on supposed empty geometries?

I am attempting to buffer some output after querying a feature service using the arcgis API for Python: from arcgis.gis import GIS from arcgis.features import FeatureLayerCollection from arcgis....
2 votes
1 answer
204 views

Generate tiles when creating tile Layer on ArcGIS Enterprise Portal

I have a raster (TIFF) that I want to publish on my ArcGIS Enterprise Portal. To reach that aim, I followed these steps : 1) Create SDDraft from TIFF in ArcGIS Pro project 2) Create SD file from ...
1 vote
1 answer
230 views

Publishing Web tool that works with data on Portal for ArcGIS and using it in Web Appbuilder

I am trying to publish a web tool from ModelBuilder in ArcGIS Pro. Inside my model there is (besides other things) a script. This script works with data on the same Portal that I want to publish the ...
0 votes
1 answer
839 views

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

I`m trying to find a way to add an online layer to my local map, through Python. I know how to grab the layer info, but don't know how to use it. onlinelayer = gis.content.search(mylayer)[0] itemid= ...
0 votes
0 answers
173 views

403 Error when overwriting feature layer in ArcGIS Online

I'm attempting to overwrite a hosted layer that I own in ArcGIS Online using the arcgis.features.FeatureLayerCollection.manager.overwrite() method in Python. However, I keep receiving a 403 Error even ...
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 ...
0 votes
0 answers
73 views

Dynamically Generated ArcGIS Storymap

I want to be able to have a user click on a polygon in an ESRI ArcGIS webmap and have a story map open that's specific to that particular polygon. There are hundreds and potentially thousands of ...
0 votes
1 answer
263 views

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

I have a hosted feature layer with a field with a domain (coded values). How do I get the description instead of the coded value? The layer is in the TOC of an aprx, and I can retrieve the domain name ...
1 vote
0 answers
106 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
1 answer
71 views

Cannot enable 'Any organization's members' setting when creating Group or updating properties using ArcGIS Python API [closed]

I am creating a group using the ArcGIS for Python API, there is limited information in the API Reference here. And I found some more information in the Rest Reference relating to the membershipAccess ...
1 vote
1 answer
37 views

What do parameters provider_group_name and provider achieve in GroupManager create function when using ArcGIS Python API?

The create() function in the GroupManager module has two parameters; provide_group_name and provider. See API Reference What is the purpose of these parameters? I cannot find any documentation ...
0 votes
1 answer
154 views

Trying to use UpdateCursor on Branch versioned layer - RuntimeError: cannot open workspace

I have a branch versioned service layer on ArcGIS Portal. I want editors to use ArcGIS Pro to open a map in a ArcGIS Pro project and use their respective versions of this layer to create new features ...
1 vote
0 answers
207 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
0 answers
92 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
1 answer
263 views

ArcGIS Python API wont run in Docker

I built a Docker container to run one of our ArcGIS Python API scripts. It ran for a couple of months successfully. Recently I added some minor enhancements and rebuilt the Docker image. Thereafter, ...