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?