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).
176
questions
1
vote
1
answer
49
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 ...
0
votes
0
answers
104
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
38
views
Saving queried features as file GDB on AGOL using ArcGIS API for Python [closed]
I am trying to save the queried features as file GDB on AGOL using Python but keep getting this error:
Failed to export to File Geodatabase: The Product License has not been
initialized.
Here is my ...
0
votes
0
answers
48
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
32
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
26
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
87
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
29
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
48
views
Convert .tif to imagery layer
I'm trying to run this notebook in ArcGIS Pro: https://developers.arcgis.com/python/samples/count-cars-in-aerial-imagery-using-deep-learning/#:~:text=imagery%20%3D%20gis.content.search(%22aerial*%22)
...
0
votes
1
answer
126
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 ...
1
vote
1
answer
159
views
Unknown error when trying to append to feature layer with ArcGIS API for Python
I am trying to perform an 'upsert' (UPDATE + INSER) operation on a feature layer via ArcGIS API for Python. My input data is a GeoJSON file that gets uploaded as per the available guides:
data_item = ...
0
votes
1
answer
79
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 ...
0
votes
1
answer
93
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
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
1
answer
34
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?
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 ...
0
votes
1
answer
51
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
1
answer
31
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 ...
2
votes
1
answer
217
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 = ...
1
vote
1
answer
250
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
187
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
30
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
165
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 ...
0
votes
1
answer
51
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 ...
0
votes
1
answer
528
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
160
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
90
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
44
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 ...
1
vote
0
answers
309
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
249
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
1
answer
339
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, ...
1
vote
0
answers
121
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 ...
0
votes
1
answer
874
views
Can you grab a JSON file off of an AGOL feature layer using Python API
I need to run a daily script that checks if data hosted on AGOL matches source data in an enterprise geodatabase. I'd like to convert the enterprise geodatabase table and a JSON file containing the ...
0
votes
1
answer
270
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
340
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'...
0
votes
1
answer
310
views
Export out list of users and user types in Portal
I'm trying to export a list of Portal users and their user types. This is the code I'm trying to use but getting an error regarding the user.LicenseTypeId entry:
import csv
from arcgis.gis import GIS
...
1
vote
1
answer
520
views
Update Modified date or Summary field of AGOL hosted feature layer using ArcGIS API for Python
I am using a Python script (see below) in ArcGIS Pro to update two existing hosted feature layers on ArcGIS Online. The script deletes all records in the existing hosted feature layers and appends the ...
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\...
0
votes
1
answer
630
views
How can I automate a consolidated back up of all AGOL feature layers with python? [closed]
What I've Tried: I have used the script in this article before. However it does require more input than I would like, and the feature layers are downloaded as individual FGDB instead of into a single, ...
0
votes
1
answer
754
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 ...
0
votes
0
answers
96
views
Using jupyter_client version with ArcGIS API for Python
I am using ArcGIS API for Python.
When I install Jupyter_client==7.1.0, I get error of arcgis 2.0.1 requires jupyter-client<=6.1.12, but you have jupyter-client 7.1.0 which is incomatible.
When I ...
0
votes
1
answer
168
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
1
answer
47
views
Manage and Publish ArcGIS Server v10.8 Services using API with no AGOL and no Portal
I have ArcGIS StageServer with Site1 and multiple Map\GeoCode\Routing Services.
There is no WebAdapter, ArcGIS Online or ArcGIS Portal installed.
We need to update multiple Production ArcGIS Servers ...
0
votes
1
answer
28
views
arcgis.features line features failing to buffer
I'm trying to write a script that buffers a line dataset.
I'm able to successfully buffer a single polygon but, when I try and buffer my three lines, the code fails.
Does anyone know what I'm doing ...
1
vote
1
answer
320
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
0
answers
113
views
ArcGIS Server Py3 - <type 'exceptions.ImportError'>, ImportError('No module named arcgis',), <traceback object at 0x00000000025870C8>
I have cloned the default python env that installs with ArcGIS Server using conda create in the python command window using:
conda create --clone arcgispro-py3 -p"C:\Program Files\ArcGIS\Server\...
3
votes
1
answer
693
views
How to make a deep copy of a Hosted Feature Service
How can I make a deep copy of a Hosted Feature Service using ArcGIS Python for API?
My hosted feature service has one layer. I'd like to copy the hosted feature service and the layer. (I want to ...
0
votes
1
answer
227
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
2
answers
336
views
Use current password in arcgis.gis
I'm currently signed into my portal through ArcGIS Pro. When I want to use a python notebook to update my portal, I use:
from arcgis.gis import GIS
my_gis = GIS(
url='https://<my Org's ...