0

I have been using the code below to import shapefiles to ArcGIS Online. It was taken from an ArcGIS tutorial linked here: https://developers.arcgis.com/labs/python/import-data/

from arcgis.gis import GIS
# Log into your ArcGIS Online account
gis = GIS("https://www.arcgis.com", username="your_username", password="your_password")
# Make a dictionary to store metadata for the shapefile
shp_properties = {
 'title': 'Los Angeles Hub Datasets',
 'tags': 'testing, this, with, python, code',
 'type': 'Shapefile'
}
# Load the data as a feature layer with a ContentManager by calling gis.content.add which returns an Item object.
data_file_location = '/path/to/Parks_and_Open_Space.zip'
shp_file = gis.content.add(shp_properties, data=data_file_location)
# Call the publish method to publihs the Shapefile, which returns another arcgis.gis.Item instance for the feature layer.
shp_feature_layer_item = shp_file.publish()
# Identify the URL
print(shp_feature_layer_item.url)

But the tutorial states it can only import CSVs, XLS, GPX, GeoJSON, and shapefiles. Is it not possible to use Python to upload raster data to ArcGIS Online?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Sep 29, 2020 at 20:04

1 Answer 1

2

You can upload hosted tiled layers to AGOL which consist of images in a tile package. The process for doing this is different than uploading content such as the formats you mentioned.

This documentation shows several methods; there are equivalent methods to perform this tile package upload to AGOL using the python API. I recommend that you get familiar with the processes of tile package creation and manually uploading it to AGOL before attempting to script these processes.

Here is the reference documentation for tile package creation.

answered Sep 30, 2020 at 0:02

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.