Learn how to use the ArcGIS Basemap Styles service to display a vector tile basemap.
The ArcGIS Basemap Styles service provides a number of basemap styles such as topography, streets, outdoor, navigation, and imagery that you can use in maps. To display a basemap style from the service in a MapLibre GL JS app, use the MapLibre ArcGIS plugin.
In this tutorial, display a map of the world with the arcgis/outdoor
basemap style.
This application will use the basemap tiles usage model .
Prerequisites
You need an ArcGIS Location Platform or ArcGIS Online account.
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 that access ArcGIS Location Services and secure items.
- 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 and access resources their behalf.
- Have an ArcGIS Online account.
To learn more about both types of authentication, go to Authentication.
Set up authentication
Set developer credentials
Add script references
Reference the MapLibre GL JS library and the MapLibre ArcGIS plugin.
-
In the index.html file, add the following
<link
and> <script
references.> Use dark colors for code blocks <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <title>MapLibre ArcGIS tutorial: Display a map</title> <style> html, body, #map { padding: 0; margin: 0; height: 100%; width: 100%; font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #323232; } </style> <!-- Load MapLibre GL JS from CDN --> <script src="https://unpkg.com/maplibre-gl@5.9.0/dist/maplibre-gl.js"></script> <link href="https://unpkg.com/maplibre-gl@5.9.0/dist/maplibre-gl.css" rel="stylesheet"> <!-- Load MapLibre ArcGIS from CDN --> <script src="https://unpkg.com/@esri/maplibre-arcgis@1.0.0/dist/umd/maplibre-arcgis.min.js"></script>
Create a map
Create a map to display an ArcGIS basemap style centered on the world. Use the MapLibre ArcGIS plugin to access the basemap style.
-
Create a
Map
that is centered on the world.Use dark colors for code blocks const map = new maplibregl.Map({ container: "map", // the id of the div element zoom: 2, // starting zoom center: [-20, 30] // starting location [longitude, latitude] });
-
Use the plugin to apply a
Basemap
to the map. The plugin will automatically apply Esri and data attribution.Style Use dark colors for code blocks const basemapStyle = maplibreArcGIS.BasemapStyle.applyStyle(map, { style: "arcgis/outdoor", token: accessToken });
Run the app
Run the app.
The map should display thearcgis/outdoor
style from the Basemap Styles service.
What's next?
Learn how to use additional location services in these tutorials:

Display a map (basemap session)
Display a map with a basemap session that lasts for 12 hours.

Change the basemap style
Switch a vector basemap style on a map.

Change language labels
Switch the language of place labels on a basemap.

Display basemap places
Display places of interest on a basemap and get place details.

Display a custom basemap style
Add a custom vector basemap style to a map.

Search for an address
Find an address or place using a search box.

Find a route and directions
Find a route and directions from a start and finish location.