Introduction to maps

A is a collection of . You use a map together with a to display layers of geographic data in 2D. Most applications contain a to display geographic data with streets or satellite imagery. The data for a basemap layer is typically provided by basemap services, such as the or .

You can use basemap layers to:

  • Display different types of geographic data of the world for a map.
  • Display vector tile styles such as streets, navigation, outdoor, and light gray canvas.
  • Display map tiles for oceans, satellite, imagery, and hillshade.
  • Display custom vector basemap styles with your own colors, glyphs, and fonts.

Basemap styles service

The basemap styles service is a that provides and data for the extent of the world. The service includes ArcGIS and OSM styles. There are default basemap styles such as streets, navigation, light gray canvas, and imagery. The data for each style is provided through vector tile layers and map tile layers hosted in ArcGIS and is stored in a Web Mercator spatial reference.

How to access the basemap styles service

The data format for ArcGIS basemap layers is based on the Mapbox vector tile specification. To access vector basemap layers, you use the ol-mapbox-style library.

  1. Reference the OpenLayers CSS, JS, and ol-mapbox-style libraries.
  2. Select a enumeration.
  3. Set the style URL and your API key.
  4. Load and apply the basemap style to a map using olms.

Example

This example loads and displays the arcgis/streets style from the . To see all of the basemap style enumerations, go to Basemap styles service in the REST API documentation.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v10.4.0/ol.css" type="text/css" />
<script src="https://cdn.jsdelivr.net/npm/ol@v10.4.0/dist/ol.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ol-mapbox-style@12.3.5/dist/olms.js"></script>
<script>

    const map = new ol.Map({ target: "map" });

    const accessToken = "YOUR_ACCESS_TOKEN";
    const basemapId = "arcgis/streets";

    const basemapURL = "https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/styles" + basemapId + "?type=style&token=" + accessToken;
    olms.apply(map, basemapURL);

</script>

Static basemap tiles service (beta)

The static basemap tiles service is a that provides basemap tiles for the extent of the world. The service supports default basemap styles such as streets, navigation, outdoor, and light gray canvas. The tiles are supplied as 512x512 .png files in a Web Mercator spatial reference.

How to access static basemap tiles service

  1. Reference the OpenLayers CSS, JS, and ol-mapbox-style libraries.
  2. Set API key and define a enumeration.
  3. Instantiate a Tile using the basemap style URL.
  4. Load and apply the tile layer to a map using olms.

Example

This example loads and displays the arcgis/outdoor style from the (beta). To see all of the basemap style enumerations available, go to the Static basemap tiles service (beta) API reference.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v10.4.0/ol.css" type="text/css" />
<script src="https://cdn.jsdelivr.net/npm/ol@v10.4.0/dist/ol.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ol-mapbox-style@12.3.5/dist/olms.js"></script>
<script>

    const accessToken = "YOUR_ACCESS_TOKEN";
    const basemapId = "beta/arcgis/outdoor";
    const basemapURL = "https://static-map-tiles-api.arcgis.com/arcgis/rest/services/static-basemap-tiles-service";

    const tileLayer = new ol.layer.Tile({
      source: new ol.source.XYZ({
        url: `${basemapURL}/${basemapId}/static/tile/{z}/{y}/{x}?token=${accessToken}`, // Default basemap
        tileSize: 512,
      }),
    });

    const map = new ol.Map({
      target: "map",
      layers: [tileLayer],
      view: new ol.View({
        center: ol.proj.fromLonLat([-91.2996, 37.1174]), // USA (x, y)
        zoom: 4,
      }),
    });


</script>

Tutorials

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close