Skip to main content

VectorBasemapStyle

For loading complete Esri Vector Basemap Styles that provide ready-to-use basemap designs with consistent styling and global coverage.

Static Methods

static applyStyle(
map: { setStyle: (style: string) => void },
styleName: EsriBasemapStyleName,
auth: VectorBasemapStyleAuthOptions
): void

Simple wrapper method for applying Esri basemap styles to a map.

Parameters

ParameterTypeDescription
map{ setStyle: (style: string) => void }Required MapLibre or Mapbox GL map instance
styleNameEsriBasemapStyleNameRequired Esri basemap style name (e.g., 'arcgis/streets')
authVectorBasemapStyleAuthOptionsRequired Authentication options

Example

// Using API key
VectorBasemapStyle.applyStyle(map, 'arcgis/streets', { apiKey: 'YOUR_API_KEY' });

// Using token
VectorBasemapStyle.applyStyle(map, 'arcgis/dark-gray', { token: 'YOUR_TOKEN' });

// With language options
VectorBasemapStyle.applyStyle(map, 'arcgis/navigation', {
apiKey: 'YOUR_API_KEY',
language: 'es'
});

// Using legacy format
VectorBasemapStyle.applyStyle(map, 'arcgis:streets', { apiKey: 'YOUR_API_KEY' });

Constructor

new VectorBasemapStyle(styleId: EsriBasemapStyleName, auth: VectorBasemapStyleAuthOptions)

Parameters

ParameterTypeDescription
styleIdEsriBasemapStyleNameRequired Esri basemap style identifier
authVectorBasemapStyleAuthOptionsRequired Authentication options

Properties

PropertyTypeDescription
styleUrlstringThe constructed style URL for MapLibre/Mapbox
authVectorBasemapStyleAuthOptionsThe authentication configuration
styleIdEsriBasemapStyleNameThe basemap style identifier

Methods

setStyle

setStyle(styleId: EsriBasemapStyleName): void

Updates the style ID and regenerates the style URL.

Parameters

ParameterTypeDescription
styleIdEsriBasemapStyleNameRequired New basemap style identifier

Types

EsriBasemapStyleName

type EsriBasemapStyleName = 
| 'arcgis/streets'
| 'arcgis/topographic'
| 'arcgis/navigation'
| 'arcgis/streets-relief'
| 'arcgis/dark-gray'
| 'arcgis/light-gray'
| 'arcgis/oceans'
| 'arcgis/imagery'
| 'arcgis/streets-night'
// Legacy colon form (for backwards compatibility)
| 'arcgis:streets'
| 'arcgis:topographic'
| 'arcgis:navigation'
| 'arcgis:streetsrelief'
| 'arcgis:darkgray'
| 'arcgis:lightgray'
| 'arcgis:oceans'
| 'arcgis:imagery'
| 'arcgis:streetsnight'
// Custom enterprise styles also supported
| string

VectorBasemapStyleAuthOptions

interface VectorBasemapStyleAuthOptions {
apiKey?: string;
token?: string;
language?: string;
worldview?: string;
}

Available Styles

Style NameDescriptionUse Case
arcgis/streetsStandard street mapGeneral purpose mapping
arcgis/topographicTopographic map with terrainOutdoor recreation, analysis
arcgis/navigationHigh-contrast navigation styleTurn-by-turn navigation
arcgis/streets-reliefStreets with hillshade reliefContext with terrain
arcgis/dark-grayDark gray reference mapDark theme applications
arcgis/light-grayLight gray reference mapData visualization overlay
arcgis/oceansBathymetric ocean mappingMarine applications
arcgis/imagerySatellite imagery basemapAerial context
arcgis/streets-nightDark streets with night stylingNight-time applications

Legacy Colon Format (Backwards Compatibility)

Style NameDescriptionModern Equivalent
arcgis:streetsStandard street maparcgis/streets
arcgis:topographicTopographic map with terrainarcgis/topographic
arcgis:navigationHigh-contrast navigation stylearcgis/navigation
arcgis:streetsreliefStreets with hillshade reliefarcgis/streets-relief
arcgis:darkgrayDark gray reference maparcgis/dark-gray
arcgis:lightgrayLight gray reference maparcgis/light-gray
arcgis:oceansBathymetric ocean mappingarcgis/oceans
arcgis:imagerySatellite imagery basemaparcgis/imagery
arcgis:streetsnightDark streets with night stylingarcgis/streets-night

Custom Enterprise Styles

The service also supports custom enterprise basemap styles by accepting any string as a style name:

// Custom enterprise style
VectorBasemapStyle.applyStyle(map, 'my-org/custom-style', {
apiKey: 'YOUR_API_KEY'
});

// Custom portal style
VectorBasemapStyle.applyStyle(map, 'enterprise/street-map-v2', {
token: 'YOUR_TOKEN'
});

Authentication

The service supports both API Key and Token authentication:

  • API Key: Use for v1 styles (basemaps-api.arcgis.com)
  • Token: Use for v2 styles (basemapstyles-api.arcgis.com)

The service automatically detects which authentication method to use based on the provided credentials.