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
0 answers
15 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
9 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 ...
  • 478
0 votes
0 answers
9 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
21 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 ...
  • 41
0 votes
0 answers
28 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 ...
  • 1,241
0 votes
0 answers
6 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 ...
  • 1,138
0 votes
0 answers
38 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,465
0 votes
0 answers
35 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 ...
  • 1,475
0 votes
0 answers
13 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
46 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 ...
  • 1,175
0 votes
0 answers
25 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 ...
  • 101
0 votes
0 answers
20 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 ...
  • 1
0 votes
0 answers
59 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 ...
  • 141
0 votes
2 answers
30 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
30 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,138
1 vote
1 answer
19 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,138
0 votes
1 answer
74 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
33 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 ...
  • 568
0 votes
1 answer
35 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 ...
  • 3
0 votes
1 answer
108 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 ...
  • 68
0 votes
0 answers
26 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
242 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 ...
  • 1,138
0 votes
1 answer
66 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
322 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
263 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
481 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
50 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 ...
  • 393
1 vote
0 answers
143 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 ...
0 votes
0 answers
40 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 ...
  • 3
2 votes
0 answers
124 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 ...
  • 55.3k
1 vote
0 answers
209 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
58 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
0 answers
51 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 ...
  • 1,037
0 votes
1 answer
133 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 ...
  • 107
0 votes
0 answers
102 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 ...
  • 287
1 vote
1 answer
165 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 ...
  • 107
0 votes
0 answers
103 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 ...
  • 133
2 votes
1 answer
239 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. ...
  • 1,465
2 votes
1 answer
127 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....
  • 287
1 vote
0 answers
209 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 ...
0 votes
0 answers
136 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-...
2 votes
0 answers
120 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. --------------------------...
  • 287
0 votes
1 answer
655 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....
  • 81
0 votes
1 answer
87 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 ...
  • 57
1 vote
0 answers
70 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....
2 votes
2 answers
236 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 ...
  • 4,155
1 vote
0 answers
21 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 ...
0 votes
0 answers
24 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 ...
2 votes
0 answers
372 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 ...
  • 21
3 votes
1 answer
1k 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'...