Learn how to use the ArcGIS Basemap Styles service to display a vector tile basemap.
The ArcGIS Basemap Styles service
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
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
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
<linkand> <scriptreferences.> 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.23.0/dist/maplibre-gl.js"></script> <link href="https://unpkg.com/maplibre-gl@5.23.0/dist/maplibre-gl.css" rel="stylesheet"> <!-- Load MapLibre ArcGIS from CDN --> <script src="https://unpkg.com/@esri/maplibre-arcgis@1.1.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
Mapthat 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
Basemapto 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.