Learn how to add a vector tile layer
A vector tile layer
In this tutorial, display a parcels layer from a vector tile service
Prerequisites
You need an ArcGIS Location Platform or ArcGIS Online account.
Steps
Review the source data
This tutorial uses the Santa Monica Mountains Parcels vector tile service
-
Go to the item page
An item page is a web page in ArcGIS Online or the developer dashboard used to access and manage the properties for an item and the content it references such as a web map, hosted layer, or file. for the Santa Monica Mountains Parcels vector tile serviceA vector tile layer is a data layer used to access and display tiled data and its corresponding styles. . -
Get the item ID of the vector tile layer from the URL, for example:
- URL:
https://www.arcgis.com/home/item.html?id=f0298e881b5b4743bbdf2c7d378acc84 - Item ID:
f0298e881b5b4743bbdf2c7d378acc84
- URL:
-
Copy the item ID and store it somewhere safe. You will need this in a later step.
Get the starter 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
Use the API key or OAuth developer credentials
Add a vector tile layer
To add the vector tile layer to your map, use the MapLibre ArcGIS plugin.
-
Use
map.on('load', ...)to register an event handler that runs only once when the map has finished loading.Use dark colors for code blocks map.on("load", async () => { }); -
Inside the load event, use the plugin to create a new
Vectorobject that references the item ID of the vector tile layer you copied earlier and add it to the map.Tile Layer Use dark colors for code blocks map.on("load", async () => { const vectorLayer = await maplibreArcGIS.VectorTileLayer.fromPortalItem("f0298e881b5b4743bbdf2c7d378acc84", { token: accessToken }); vectorLayer.addSourcesAndLayersTo(map); });
Run the app
Run the app.
You should see the vector tile layer with light blue parcels displayed on the basemap.What's next?
Learn how to use additional location services in these tutorials:


