Add a raster tile layer
Learn how to add a raster tile layer to a map.
A raster tile layer, also known as an image tile layer, displays imagery such as satellite photography or hillshading. You can combine raster tile layers to enhance the display of a street basemap layer, position the layer on top of existing layers, or position it under existing layers. When positioned above other layers, you need to give the raster tile layer a level of transparency so that users can see through it to the basemap. This combined basemap layer technique is used to enhance overall visualization.
In this tutorial, you add a Hillshade raster tile layer, which is a basemap layer composed of jpeg images, on top of a street basemap layer.
Prerequisites
You need an ArcGIS Developer or ArcGIS Online account to access the developer dashboard and create an API key.
Steps
Create a new pen
- To get started, either complete the Display a map tutorial or .
Set the API key
To access location services, you need an API key or OAuth 2.0 access token. To learn how to create and scope your key, visit the Create an API key tutorial.
Go to your dashboard to get an API key. The API key must be scoped to access the services used in this tutorial.
In CodePen, update
api
to use your key.Key Use dark colors for code blocks Change line
Create an image tile layer
To load the hillshade tiles, you will create an XYZ
source, using an XYZ URL. This is a URL with {x}
, {y}
and {z}
elements which the source substitutes with numbers when requesting each tile. The source can be displayed using a Tile
layer with the source
property. Set the opacity
to 0.3 so that the basemap can be seen through the hillshade layer.
The URL for the hillshade image tile layer is:
Add a load handler to the
olms
initialization. Inside, create anXYZ
source using the XYZ url for the hillshade layer.Use dark colors for code blocks Add line. Add line. Add line. Add line. Add line. Add line. Create a
Tile
layer using theXYZ
source, with 0.3 opacity. Add it to the map usingmap.add
.Layer Use dark colors for code blocks Add line. Add line. Add line. Add line. Add line. Add line.
Run the app
In CodePen, run your code to display the map.
Your map should display a semi-transparent hillshade layer overlaid over a basemap.
What's next?
Learn how to use additional ArcGIS location services in these tutorials: