Update an image service

Updating an image service with new raster data is a common workflow in ArcGIS. In ArcGIS Online, only a dynamic imagery layer with the image collection layer configuration for an image service supports the removal of old images and addition of new ones. An image service powered by a tiled imagery layer does not support this workflow, and needs to be replaced entirely if an update is needed. As for image services in ArcGIS Enterprise, the updating an image service workflow is fully supported without any limitation.

How to update an image service

The general steps for preparing raster data:

1. Get the raster data

There are two types of data sources to create an image service: your own raster data and data hosted in ArcGIS.

Data SourceDescription
Your dataFor example: GEOTIFF, PNG. See supported raster input formats.
ArcGIS OnlineProvides a platform for users to host and share their own raster data that can then be accessed and used for visualization and analysis purposes.
ArcGIS HubContains many imagery layers from various sources that you can use in your applications. Some of the raster data can be obtained from the original sources and hosted in your ArcGIS Online organization.
ArcGIS Living AtlasA collection of geographic information that includes a raster data. You can access and visualize raster data in your maps and apps.

2. Optimize raster data

There are data preparation toolbox tools available in ArcGIS Pro to optimize your raster data before creating an image service:

ToolDescription
Building pyramids and statisticsBuilding pyramids enhances raster display performance. Calculating statistics aids raster data display. All raster formats are processed. Learn more in Build Pyramids And Statistics (Data Management).
Calculate statisticsCreate important statistical information like minimum, maximum, mean, and standard deviation values are generated for your raster data. This statistical information is important for tasks like applying contrast stretches and classifying the raster data. Learn more in Calculate statistics

3. Find the image service

To access an image service, you can use the service URL or item ID. To find this information, you need to go to the hosted imagery layer item page for the dataset in your portal.

The steps to find and access layers are:

  1. Log in to your portal with your ArcGIS account.
  2. In My Content, find your hosted imagery layer (item).
  3. In the hosted imagery layer item page, find the service URL or item ID.

Service URL

To access the hosted imagery layer in the service directly, use the URL for the layer:

Use dark colors for code blocksCopy
1
https://{host}/{organizationID}/ArcGIS/rest/services/{serviceName}/ImageServer

Item ID

To access the layer and service through an item, use the portal URL and item ID.

Use dark colors for code blocksCopy
1
https://{organizationURL}/sharing/rest/content/items/{hostedLayerItemId}

4. Update the image service

The general steps for adding new rasters to an image service are:

  1. Specifiy the path to the new raster files.
  2. Iterate through each file and add them to the existing image collection.
  3. Update the item.

Code examples

Add new raster data to an image service

Below is an example that demonstrates how to add new raster data to an existing image service:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Specify the new raster data you want to add
new_raster_paths = [
    r"C:\path\to\raster1.tif",
    r"C:\path\to\raster2.tif",
    r"C:\path\to\raster3.tif"
]

# Add the new rasters to the image service
image_collection = image_service.layers[0]
for raster_path in new_raster_paths:
    image_collection.add_rasters([raster_path])

# Publish the updated image service
image_service.update(item_properties={
    "title": image_service_name,
    "tags": "updated image service"
})

Delete raster data in an image service

Below is an example that demonstrates how to delete raster data from an existing image service:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Delete the specified rasters from the image service
image_collection = image_service.layers[0]
for raster_name in rasters_to_delete:
    image_collection.delete_rasters([raster_name])

# Publish the updated image service
image_service.update(item_properties={
    "title": image_service_name,
    "tags": "updated image service"
})

Replace existing raster data in an image service with new raster data

Below is an example that demonstrates how to replace existing raster data in an image service with new raster data:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Specify the new raster data you want to add
new_raster_paths = [
    r"C:\path\to\new_raster1.tif",
    r"C:\path\to\new_raster2.tif",
    r"C:\path\to\new_raster3.tif"
]

# Specify the rasters you want to replace
rasters_to_replace = [
    "old_raster1.tif",
    "old_raster2.tif",
    "old_raster3.tif"
]

# Replace the existing rasters with the new ones
image_collection = image_service.layers[0]
for i, raster_to_replace in enumerate(rasters_to_replace):
    image_collection.delete_rasters([raster_to_replace])
    image_collection.add_rasters([new_raster_paths[i]])

Services

API support

Use data management tools or Client APIs to create, manage, and access data services. The table below outlines the level of support for each API.

CreateManageAccess
ArcGIS Maps SDK for JavaScript1
ArcGIS Maps SDK for Kotlin1
ArcGIS Maps SDK for Swift1
ArcGIS Maps SDK for Java1
ArcGIS Maps SDK for .NET1
ArcGIS Maps SDK for Qt1
ArcGIS API for Python
ArcGIS REST JS
Esri Leaflet2
MapLibre GL JS23
OpenLayers23
Full supportPartial supportNo support
  • 1. Use portal class and direct REST API requests
  • 2. Access via ArcGIS REST JS
  • 3. Requires manually setting styles for renderers

Tools

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.