Learn how to use the ArcGIS Static Basemap Tiles service to display a raster tile basemap.
The ArcGIS Static Basemap Tiles service
In this tutorial, you display the ArcGIS Navigation basemap style provided by the service.
Prerequisites
You need an ArcGIS Location Platform account.
ArcGIS Online and ArcGIS Enterprise accounts are not supported.
Steps
Create a new app
Select a type of authentication and follow the steps to create a new app.
Choose API key authentication if you:
- Want the easiest way to get started.
- Want to build public applications
A public application is an application that allows anonymous access without requiring users to sign in with an ArcGIS account. It supports API key or app authentication. that access ArcGIS Location ServicesArcGIS Location Services, also referred to as Location Services, are services hosted by Esri that provide geospatial functionality for developing mapping applications. They include the ArcGIS Basemap Styles service, ArcGIS Static Basemap Tiles service, ArcGIS Places service, ArcGIS Geocoding service, ArcGIS Routing service, ArcGIS GeoEnrichment service, and ArcGIS Elevation service. An ArcGIS Location Platform or ArcGIS Online account is required to use the services. and secure itemsAn item, also known as a content item, is a resource stored in a portal such as a web map, hosted layer, style, script tool, file, or notebook. . - Have an ArcGIS Location Platform or ArcGIS Online account.
Choose user authentication if you:
- Want to build private applications.
- Require application users to sign in with their own ArcGIS account
An ArcGIS account is an identity with a user type and set of privileges that can access specific ArcGIS products, tools, APIs, services, and resources. The main account types that can be used for development are an ArcGIS Location Platform account, ArcGIS Online account, and ArcGIS Enterprise account. ArcGIS Location Platform and ArcGIS Online accounts are also associated with a subscription. and access resources their behalf. - Have an ArcGIS Online account.
To learn more about both types of authentication, go to Authentication.
Set up authentication
Create API key or OAuth developer credentials
Set developer credentials
Create a map
-
Create a
basemapandEnum baseto reference the style URL forUrl arcgis/navigation.Use dark colors for code blocks <script> /* Use for API key authentication */ const accessToken = "YOUR_ACCESS_TOKEN"; // or /* Use for user authentication */ // const session = await arcgisRest.ArcGISIdentityManager.beginOAuth2({ // clientId: "YOUR_CLIENT_ID", // Your client ID from OAuth credentials // redirectUri: "YOUR_REDIRECT_URI", // The redirect URL registered in your OAuth credentials // portal: "https://www.arcgis.com/sharing/rest" // Your portal URL // }) // const accessToken = session.token; const basemapEnum = "arcgis/navigation"; const baseUrl = "https://static-map-tiles-api.arcgis.com/arcgis/rest/services/static-basemap-tiles-service/v1"; </script> -
Create a
Mapwith a raster tile source that loads tiles from the Static Basemap Tiles service using thebasemapas the default style.Enum Use dark colors for code blocks <script> /* Use for API key authentication */ const accessToken = "YOUR_ACCESS_TOKEN"; // or /* Use for user authentication */ // const session = await arcgisRest.ArcGISIdentityManager.beginOAuth2({ // clientId: "YOUR_CLIENT_ID", // Your client ID from OAuth credentials // redirectUri: "YOUR_REDIRECT_URI", // The redirect URL registered in your OAuth credentials // portal: "https://www.arcgis.com/sharing/rest" // Your portal URL // }) // const accessToken = session.token; const basemapEnum = "arcgis/navigation"; const baseUrl = "https://static-map-tiles-api.arcgis.com/arcgis/rest/services/static-basemap-tiles-service/v1"; const map = new maplibregl.Map({ container: "map", style: { version: 8, sources: { "raster-tiles": { type: "raster", tiles: [ `${baseUrl}/${basemapEnum}/static/tile/{z}/{y}/{x}?token=${accessToken}` ], tileSize: 512 } }, layers: [ { id: "simple-tiles", type: "raster", source: "raster-tiles", minzoom: 0, maxzoom: 22 } ] }, zoom: 2, center: [-20, 30] }); </script> -
Create a
fetchrequest to retrieve and display the required Esri and data attribution on the map.Use dark colors for code blocks const map = new maplibregl.Map({ container: "map", style: { version: 8, sources: { "raster-tiles": { type: "raster", tiles: [ `${baseUrl}/${basemapEnum}/static/tile/{z}/{y}/{x}?token=${accessToken}` ], tileSize: 512 } }, layers: [ { id: "simple-tiles", type: "raster", source: "raster-tiles", minzoom: 0, maxzoom: 22 } ] }, zoom: 2, center: [-20, 30] }); fetch(`${baseUrl}/${basemapEnum}/static?token=${accessToken}`) // Display required Esri and data attribution .then((response) => response.json()) .then((data) => { map._controls[0]._innerContainer.innerText += " | Powered by Esri | " + data.copyrightText; });
Run the app
Run the app.
The map should display thearcgis/navigation style from the Static Basemap Styles service.
What's next?
Learn how to use additional location services in these tutorials:


