Before you create an image service, you first need to prepare your input data then select the capabilities you want the image service to support. Once you have determined the functionality, you use data management tools to publish a hosted imagery layer (item) and image service. This process is known as publishing a imagery layer. After an image service is created, you can use the hosted imagery layer to manage the layer and the service settings.
The general steps to work with image services.
1. Prepare source data
Before hosting raster data as an image service, it is essential to optimize the raster data. This will ensure optimal performance and user experience for analysis and visualization tasks.
To prepare your source data:
2. Select image service output data
Select the output data you would like the image service to provide based on your specific requirements. This can include specifying the type and format of the image, as well as any additional metadata or analytical results.
-
Tiled imagery layer (static tiles)
An image service supports accessing data as static tiles which are pre-generated and cached tiles that include additional data such as the source pixel values. These tiles are stored in formats like LERC2D, JPEGPLUS, or JPGPNG.
-
An image service enables access to data as dynamically generated images. These images are produced for each request to the service, returning a new image along with metadata such as the image's URL, extent, width, and height. The functions and parameters can be adjusted for each request, allowing the creation of multiple image products on demand from a single source.
3. Create image service
To create an imagery layer in an image service, you begin by uploading your raster files to the portal using data management tools or Client APIs.
To create an image service:
- Select the capabilities you want your image service to support.
- Configure the raster properties as needed.
- Upload a single raster dataset or multiple raster dataset types.
- Manage the image service settings through a hosted imagery layer (item) in your portal.
Code examples
Here are code examples to create an image service.
import arcgis
from arcgis.gis import GIS
from arcgis.raster.analytics import copy_raster
# Connect to your portal
gis = GIS(username="USERNAME", password="PASSWORD")
# Define the path to your raster data
raster_path = r"C:\path\to\your\raster.tif"
# Define the name for your new image service
image_service_name = "MyImageService"
# Create the image service
image_service = copy_raster(
input_raster=raster_path,
output_name=image_service_name,
gis=gis,
raster_type_name="Raster Dataset",
context={"image_collection_properties": {"imageCollectionType": "Satellite"}}
)
# Print the URL of the newly created image service
print(f"Image service created: {image_service.url}")
4. Access the image service
The steps to display imagery layer are:
- Get the URL for the imagery layer service you want to display.
- Set the service URL for the imagery layer service.
- Add the layer to a map.
const imageryLayer = new ImageryLayer({
portalItem: {
id: "63fe6ad86c3d4536a3c44a0fbad0045e",
},
})
map.add(imageryLayer)
Services
Feature service
Add, update, delete, and query feature data.
Vector tile service
Store and access vector tile data.
Map tile service
Store and access map tile data.
Image service
Store and access imagery and raster data.
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.
- 1. Use portal class and direct REST API requests
- 2. Access via ArcGIS REST JS
- 3. Requires manually setting styles for renderers