Questions tagged [arcgis-python-api]

ArcGIS Python API for working with ArcGIS Online and Portal for ArcGIS

Filter by
Sorted by
Tagged with
0 votes
1 answer
9 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 ...
user avatar
  • 1,026
0 votes
0 answers
15 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)...
user avatar
1 vote
1 answer
25 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 ...
user avatar
  • 568
0 votes
1 answer
26 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 ...
user avatar
  • 1
0 votes
1 answer
41 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 ...
user avatar
  • 68
0 votes
0 answers
17 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 ...
user avatar
0 votes
0 answers
89 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 ...
user avatar
  • 1,026
0 votes
1 answer
41 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 ...
user avatar
0 votes
0 answers
129 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 ...
user avatar
0 votes
1 answer
140 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 ...
user avatar
4 votes
1 answer
157 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 ...
user avatar
0 votes
0 answers
27 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 ...
user avatar
  • 393
1 vote
0 answers
86 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 ...
user avatar
0 votes
0 answers
35 views

Converting feature layer to point using ArcPy with ArcGIS API for Python

I'm using jupyter notebooks (localhost, not in pro or AGOL), and I want to convert a feature layer to point. I've been trying to do it using arcpy.FeatureToPoint_management() but I'm having some ...
user avatar
  • 1
2 votes
0 answers
61 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 ...
user avatar
  • 52.4k
1 vote
0 answers
81 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....
user avatar
2 votes
0 answers
43 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? ...
user avatar
0 votes
0 answers
28 views

Update Source of PDF file on ArcGIS Portal

I have a map in PDF file uploaded on my portal. I get weekly updates from some other system and after processing it, I generate a new map and update it manually via Portal interface. I have automated ...
user avatar
  • 1,027
0 votes
1 answer
79 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 ...
user avatar
  • 97
0 votes
0 answers
68 views

A change in Python API for ArcGIS Online regarding geocoding?

from arcgis.gis import GIS my_gis = GIS() m = my_gis.map('Stockholm, Sweden') m This has previously worked but now second last line takes a lot of time and gives following error. Wondering if this ...
user avatar
  • 287
0 votes
1 answer
114 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 ...
user avatar
  • 97
0 votes
0 answers
65 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 ...
user avatar
  • 133
1 vote
1 answer
142 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. ...
user avatar
  • 1,445
2 votes
1 answer
89 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....
user avatar
  • 287
1 vote
0 answers
94 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 ...
user avatar
0 votes
0 answers
96 views

Error when cloning ArcGIS Portal file based items

I'm trying to set up some ArcGIS Python code (in ArcGIS Pro Notebook) which aims at cloning Portal users, groups and items like in https://developers.arcgis.com/python/sample-notebooks/clone-portal-...
user avatar
2 votes
0 answers
101 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. --------------------------...
user avatar
  • 287
0 votes
1 answer
418 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....
user avatar
  • 81
0 votes
1 answer
51 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 ...
user avatar
  • 55
1 vote
0 answers
68 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....
user avatar
2 votes
2 answers
108 views

Downloading ArcGIS Online feature service using ArcGIS Python API

I rarely use ArcGIS Online but I have been tasked to download all layers on this https://services5.arcgis.com/gFh7gtZrHd449arT/arcgis/rest/services/greenez514_SW5_District_Layers/FeatureServer I found ...
user avatar
  • 4,125
1 vote
0 answers
20 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 ...
user avatar
0 votes
0 answers
21 views

Publish OGCFeatureService ArcGIS online - Python

I have successfully uploaded a geojson file to arcgis online, and published it to a feature service. I have read through the API documentation and for the life of me I can't work out how to publish ...
user avatar
2 votes
0 answers
331 views

arcgis to_featurelayer() crashes kernel with ImportError: PyCapsule_Import could not import module "datetime" [closed]

My python kernel and ArcGIS both crash when I try to export a spatially enabled DataFrame to a featurelayer or featureclass in one of my virtual environments. In addition to the python and ArcGIS ...
user avatar
3 votes
1 answer
930 views

Overwriting Feature Layer on ArcGIS Online using ArcGIS Python API

I get a generic error "Job Failed" when using the below code to try and overwrite a feature layer on ArcGIS Online: shp_fp = 'E:\folder\shapefile.shp' feat_id = 'q3p094rupqe9vntowe98w98eyt0w'...
user avatar
1 vote
0 answers
93 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 ...
user avatar
  • 191
0 votes
0 answers
25 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,...
user avatar
0 votes
0 answers
48 views

How to save result of arcgis.learn.prepare_data (ArcGIS Pro)

After running 'Export training data for deep learning' tool in ArcGIS Pro, named as 'training_folder', I did data augmentation on the 'training_folder' using arcgis.learn.prepare_data. Then, I would ...
user avatar
  • 257
0 votes
0 answers
70 views

ArcGIS Python Overwrite AGOL Feature Class with Spatially Enabled Dataframe

To sum it up, I've accessed an AGOL Feature Class, converted the point layer to a Spatially Enabled DataFrame (SEDF), and made the edits to the attributes that I needed. I have the Dataframe I want, ...
user avatar
  • 131
0 votes
0 answers
39 views

Python: Unexpected area results after converting lat/long coordinates to wkid:3857

My end-goal is to be able to calculate the areas of small polygons (between 1000 and 5000 sq ft) with lat/long coordinates. I am having some unexpected results when doing this and decided to switch to ...
user avatar
  • 101
1 vote
0 answers
266 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 ...
user avatar
  • 335
2 votes
1 answer
531 views

Upload GeoJSON files to ArcGIS Online content

I would like to upload local GeoJSON files with Python automatically to ArcGIS Online. Now I have to upload them one for one, which takes quite some time. So I looked into the ArcGIS API for Python. I ...
user avatar
  • 115
1 vote
1 answer
386 views

Back-up Feature Services with a script

Goal: I want to create copies of feature services and save them in a FGDB in a network folder on my machine. The overall purpose of the script is to have back-ups of my authoritative feature services ...
user avatar
  • 792
2 votes
0 answers
294 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 ...
user avatar
1 vote
1 answer
436 views

ArcGIS : You do not have permissions to use this resource. (Error Code: 401)

I am trying to query Demographic data using ArcGIS Python API and the following is my code to do the same. from arcgis.gis import GIS from arcgis.geoenrichment import Country, enrich, BufferStudyArea ...
user avatar
1 vote
1 answer
212 views

Using ArcGIS Python API to consume standalone ArcGIS REST API

I have access to a ArcGIS REST API service running on a standalone, unfederated ArcGIS Server. (Not AGOL or ArcGIS Enteprise) ie (https://xxxx.xxxxx.com/arcgis/rest/services/xxxxxx/xxxxMap/MapServer) ...
user avatar
1 vote
0 answers
32 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 ...
user avatar
  • 85
0 votes
1 answer
133 views

Esri Notebook - Select and append records to table

Using Notebook editor in ArcGIS Online i want to extract from a FC table, those records with a specific data and then insert them into a separate table. I am trying the code below, but getting an &...
user avatar
  • 459
0 votes
2 answers
250 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 ...
user avatar
  • 113
1 vote
1 answer
166 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 ...
user avatar