TransWikia.com

Upload raster data using ArcGIS API for Python?

Geographic Information Systems Asked on February 15, 2021

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?

One Answer

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.

Correct answer by JasonInVegas on February 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP