Select to view content in your preferred language

Empty DataFrame return for Usage property on hosted raster tile service

120
0
02-05-2025 04:53 AM
Labels (1)
IanHand89
New Contributor

Hi,

I have a simple piece of code which I'm hoping I might be able to get a solution to. It specifically pulls usage for an item for the last 7 days or whatever desired date range. It appears to work fine for hosted feature services, and for some hosted raster tile services. However, when I run it on a specific item that I need data for it fails. Some of the key components of said service is that it's a hosted raster tile layer, it is shared to two groups and is shared to Organization level. Here is code below, with what is returned when ran on one of the hosted raster tile layers:

 

from arcgis.gis import GIS

# Authenticate
agol = GIS("https://xyzxy.arcgis.com", "xyzxyz", "xyzxyzx")

# Get item
item_id = "xxxxxxxxxxxxxxxxxx"
test_item = agol.content.get(item_id)

# Fetch usage statistics for the past 7 days
result = test_item.usage(date_range="7D")

# Print results
print(result)

 

returns when ran on one of the specific hosted raster tile services:

 

Empty DataFrame
Columns: [Date, Usage]
Index: []

 

 

When ran on a hosted feature service shared to the same groups:

 

        Date  Usage
0 2025-01-29   7915
1 2025-01-30   9296
2 2025-01-31   8641
3 2025-02-01    891
4 2025-02-02    993
5 2025-02-03   6359
6 2025-02-04  13307
7 2025-02-05   2658

 

 

Thanks in advance.

0 Replies