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).
151
questions
0
votes
0
answers
19
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
61
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
51
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
101
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
54
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
33
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
65
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
31
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
28
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
0
answers
92
views
Output Spatial Dataframe/Dataframe to Table on ArcGIS Online
I have a fairly simple notebook that takes a feature layer and converts it to an sdf and ultimately a df. I would simply like to output this as a table to ArcGIS Online. I hope it's a simple path ...
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 ...
0
votes
0
answers
31
views
Importing arcgis module hangs after installation of ArcGIS Pro 3.0
I recently upgraded to ArcGIS Pro v3.0 from v2.9. I had some notebooks written which used the ArcGIS API for Python module, which worked fine before. Now, when I try to import the arcgis module -
...
0
votes
0
answers
77
views
ModuleNotFoundError: No module named 'arcgis'
I was able to import the arcgis module in jupyter notebook fine until today.
However, when I ran 'conda list', arcgis v.1.8.5 was listed among the available modules. Moreover, whenever I import the ...
0
votes
0
answers
99
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
11
views
What does the height and width properties of an AGOL WebMap object actually do?
The WebMap object has a height and a width property but what do they control? What is their purpose?
See the height property in the API Document
See the width property in the API Document.
from arcgis ...
0
votes
0
answers
64
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
208
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
0
answers
51
views
Increase Image Resolution using SuperResolution freezes in ArcGIS Pro
I'm trying to implement the ArcGIS Pro Deep Learning example shown here:
Increase Image Resolution using SuperResolution
I have installed all the required libraries and configured the environment, ...
0
votes
1
answer
89
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
0
answers
50
views
Retrieving slope or aspect from ArcGIS layer with ArcGIS Python API
I have a set of points I would like to retrieve the slope or aspect from within a Jupyter notebook. I am using an enterprise geoportal server, and when I view the (Esri Living Atlas) Aspect or Slope ...
0
votes
0
answers
56
views
Creating dict of class argis.features
I'm currently working on a project that probably in the future will have more 'properties' objects in the geojson api and update them in my feature services, I would like to speed up my process ...
0
votes
0
answers
196
views
Set JSON data for Web Mapping Application item in AGOL
I am trying to upload a definition for a Web Mapping Application to ArcGIS Online using arcgis.gis. I have a .json file "testWebMappingApplication.json" where I have defined the data for the ...
0
votes
2
answers
36
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
54
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
27
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
286
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
51
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
60
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
392
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
0
answers
62
views
Error 500: Unable to getParts for Multipart item when adding content to Portal that has an AWS Data Store
I am using ArcGIS API for Python to upload content to Portal using the gis.content.add and then publish methodology (this process needs to be automated). It works great with small/regular sized ...
0
votes
0
answers
390
views
ArcGIS API for Python Create Feature Service with Feature Layer and Table from Shapefile and CSV
I have a point shapefile with one field, a unique id called reg_no. I have a csv file with a reg_no column and other fields. I want to create a Feature Service in AGOL with the point geometry as a ...
0
votes
1
answer
235
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
89
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
0
answers
528
views
Issue with Python Script: Overwriting Hosted Feature Layer on ArcGIS Online: Error Code: 406
I need assistance with my script. Can anyone point me in the right direction?
I'm attempting to overwrite a feature layer with data from a CSV file, both of which are hosted on my portal on ArcGIS ...
0
votes
1
answer
481
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
1k
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 ...
0
votes
0
answers
128
views
Filter invalid geometries in a spatial dataframe
I'd like to join two spatial DataFrames using the ArcGIS API for Python, arcgis.__version__='1.9.0', but the join keeps failing, "likely" based on invalid geometries.
import arcgis
import ...
1
vote
0
answers
290
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
252
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
561
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
101
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?
...
0
votes
1
answer
233
views
Access ArcGIS Python environment, installed via in Anaconda Navigator, from .bat script in normal cmd window?
I'm trying to run a Python script (shapefile_upload.py) which uses ArcGIS libraries. I installed the ArcGIS libraries by following exactly these instructions.
The Python script uploads a shapefile to ...
1
vote
1
answer
281
views
Upload shapefiles to ArcGIS Online using Python script on computer without ArcGIS Pro installation [closed]
We are trying to automate the upload of shapefiles to ArcGIS Online using a Python script. This script will need to run on a (virtual) computer that does not have an ArcGIS Pro installation. We have a ...
0
votes
0
answers
155
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 ...
2
votes
2
answers
394
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
248
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....
1
vote
0
answers
466
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 ...
2
votes
0
answers
211
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.
--------------------------...
0
votes
1
answer
1k
views
ArcGIS Python API "unable to generate token" upon login attempt
I've been trying to log into either my ArcGIS Online or ArcGIS Enterprise portal through the ArcGIS Python API.
Using the GIS module, I have tried the following:
gis = GIS("https://subdomain....
0
votes
1
answer
157
views
How to specify the default display style for a FeatureLayer using ArcGIS (Python) API?
Is there a way to edit the default display style of FeatureLayer on ArcGIS Online via the (Python) API?
Currently I can use the gis module to publish a GeoJSON to ArcGIS Online.
The GeoJSON in ...