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).
162
questions
0
votes
0
answers
16
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
20
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
19
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
14
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
0
answers
16
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
30
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
0
answers
10
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
0
answers
70
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 ...
0
votes
1
answer
69
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
45
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
36
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
20
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
0
answers
98
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
92
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
34
views
arcpy.management.DeleteField working in Pro notebook but not online hosted notebook
I'm trying to take some models in ArcGIS Pro that I've built, and translate them into a AGOL Advanced notebook. Originally I was building the notebook in Pro for testing. However I just tried it in ...
1
vote
1
answer
164
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, ...
0
votes
0
answers
52
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
256
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
76
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
175
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
0
answers
54
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
0
answers
113
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
301
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
200
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
217
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
244
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
65
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
131
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
40
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
0
answers
52
views
Print webmap extent in ArcGIS Python API
Below is my code, all variables are defined in the above cells in my Jupyter notebook, it throws no errors, and the Pandas dataframes work but no output is returned. I have all necessary libraries ...
0
votes
1
answer
21
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
164
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
81
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\...
1
vote
0
answers
436
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
133
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
144
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 ...
0
votes
1
answer
63
views
ArcGIS Online User object 'report' method/function errors
According to the API docs for User object there is a 'report' function.
https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.User
I have an Administrator user role.
When I ...
1
vote
1
answer
32
views
What does 'mode' mean in and AGOL WebMap operational layer properties?
I am accessing an Operational Layer in a WebMap and updating some properties. There is a 'mode' property that is set to 1. What does mode mean? and what values will it accept? and what does each value ...
1
vote
1
answer
450
views
users.search resturns only Creator users in ArcGIS Python API
I am trying to search for all the users in Portal (10.9.1). I find that it only returns Creator users. I am looking for all the users. The query below uses wildcard.
users = arcgis.gis.UserManager(gis)...
1
vote
1
answer
60
views
out_field in ArcGIS Python API returning unwanted fields
I am trying to output ONLY the Name Field in sdf using ArcGIS Python API and Notebook like thia
query = layer.query(where="POP2010 > 1000000", out_fields='NAME')
query.sdf
But I am ...
0
votes
1
answer
76
views
Randomly select points in a feature layer
Context: I'm working on AGOL notebooks
I have a feature layer (points). So, I'd like to randomly select several points based on the value in one of the columns ('level_' column).
For instance, I'd ...
1
vote
1
answer
696
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 ...
0
votes
1
answer
350
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 ...
0
votes
1
answer
118
views
I am trying to perform a machine learning analyis using the ArcGIS module in Jupyter notebooks but strange error
I was trying to import all modules for ArcGIS to perform a machine learning analysis. However, the code gives me an error at the line from arcgis.learn.
Code:
%matplotlib inline
import pandas as pd
...
0
votes
1
answer
642
views
Converting dataframe with WKT column to spatial dataframe in ArcGIS API for Python
I am querying a data set from an Oracle spatial server with the geometry field in a WKT format, and I am running into issues trying to convert it to a spatial dataframe using the ArcGIS API. Going ...
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 ...
1
vote
0
answers
406
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 ...
2
votes
0
answers
366
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 ...
1
vote
0
answers
847
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....
2
votes
0
answers
119
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?
...