require(["esri/dijit/BasemapLayer"], function(BasemapLayer) { /* code goes here */ });
Description
(Added at v2.1)
Defines a layer that will be added to a basemap and displayed in the
BasemapGallery
dijit.
Samples
Search for
samples that use this class.
Constructors
CSS
esri/dijit/BasemapLayer | Download source
Properties
copyright | String | The attribution information for the layer. |
fullExtent | Extent | The full extent of the layer. |
initialExtent | Extent | The initial extent of the layer. |
styleUrl | String | A url to a JSON file containing the stylesheet information to render the VectorTileLayer. |
subDomains | String[] | The subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). |
tileInfo | TileInfo | The tile info for the layer including lods, rows, cols, origin and spatial reference. |
tileServer | String[] | Additional tile server domains for the layer. |
type | String | The type of layer. |
Constructor Details
Creates a new BasemapLayer object.
Parameters:
<Object > params |
Required |
Set of parameters used to create a basemap layer. See the list below for details. |
params
properties:
<Number[] > bandIds |
Optional |
If the url points to an image service, you can specify which band ids will display. If not set, the first three available band ids will display. |
<String > copyright |
Optional |
The attribution information for the layer. NOTE: This property is only applicable to layers of type WebTiledLayer. |
<Number[] > displayLevels |
Optional |
If the url points to a cached map service you can specify the levels to draw. If not set, all display levels the service supports are drawn. |
<Extent > fullExtent |
Optional |
Specify the full extent of the layer. If no value is specified the default value, world extent in Web Mercator, is used. NOTE: This property is only applicable to layers of type WebTiledLayer. |
<Extent > initialExtent |
Optional |
Specify the initial extent of the layer. If no value is specified the default value, world extent in Web Mercator, is used. NOTE: This property is only applicable to layers of type WebTiledLayer. |
<Boolean > isReference |
Optional |
Set to true if the layer is a reference layer and should be drawn on top of all other layers in the map. |
<Number > opacity |
Optional |
Initial opacity or transparency of the basemap layer. Values range from 0.0 to 1.0 where 0.0 is 100% transparent and 1.0 has no transparency. The default value is 1.0. |
<String > styleUrl |
Optional |
A url to a JSON file containing the stylesheet information to render the VectorTileLayer. |
<String[] > subDomains |
Optional |
Specify subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). If subDomains are specified, the urlTemplate should include a ${subDomain} place holder. NOTE: This property is only applicable to layers of type WebTiledLayer. |
<String > templateUrl |
Optional |
The URL template used to retrieve the tiles. The templateUrl follows a pattern of http://some.domain.com/${Z}/${X}/${Y}/ where Z corresponds to a zoom level, and X and Y represent tile column and row, respectively. Required if the BasemapLayer is a WebTiledLayer. |
<TileInfo > tileInfo |
Optional |
Define the tile info for the layer including lods, rows, cols, origin and spatial reference. NOTE: This property is only applicable to layers of type WebTiledLayer. |
<String[] > tileServer |
Optional |
Define additional tile server domains for the layer. NOTE: This property is only applicable to layers of type WebTiledLayer. |
<String > type |
Optional |
The type of layer. Valid values are "BingMapsAerial", "BingMapsHybrid", "BingMapsRoad", "OpenStreetMap", "VectorTileLayer" or "WebTiledLayer". For Bing and OpenStreetMap basemaps specify type property. For WebTiledLayer basemap both url and type are required. For VectorTileLayer both styleUrl and type are required. |
<String > url |
Optional |
URL to the ArcGIS Server REST resource that represents a map or image service. Must specify either the url or type parameter. |
<Number[] > visibleLayers |
Optional |
If the url points to a dynamic map service you can specify a subset of layers to display. If not set, all visible layers are displayed. |
Sample:
require([
"esri/dijit/BasemapLayer", ...
], function(BasemapLayer, ... ) {
var publicSafetyLayer = new BasemapLayer({
url: "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyBasemap/MapServer"
});
// add vector tile layer as a basemap layer
var vtlayer = new BasemapLayer({
styleUrl: "https://www.arcgis.com/sharing/rest/content/items/5ad3948260a147a993ef4865e3fad476/resources/styles/root.json",
type: "VectorTileLayer"
});
});
Property Details
The attribution information for the layer. NOTE: This property is only applicable to layers of type WebTiledLayer. (Added at v3.7)
The full extent of the layer. If no value is specified the default value, world extent in Web Mercator, is used. NOTE: This property is only applicable to layers of type WebTiledLayer. (Added at v3.7)
The initial extent of the layer. If no value is specified the default value, world extent in Web Mercator, is used. NOTE: This property is only applicable to layers of type WebTiledLayer. (Added at v3.7)
A url to a JSON file containing the stylesheet information to render the VectorTileLayer. (Added at v3.15)
Sample:
var vtlayer = new BasemapLayer({
styleUrl: "https://www.arcgis.com/sharing/rest/content/items/5ad3948260a147a993ef4865e3fad476/resources/styles/root.json",
type: "VectorTileLayer"
});
The subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). NOTE: This property is only applicable to layers of type WebTiledLayer. (Added at v3.7)
The tile info for the layer including lods, rows, cols, origin and spatial reference. NOTE: This property is only applicable to layers of type WebTiledLayer. (Added at v3.7)
Additional tile server domains for the layer. NOTE: This property is only applicable to layers of type WebTiledLayer. (Added at v3.7)
The type of layer. For Bing and OpenStreetMap basemaps specify type property. For WebTiledLayer basemap both url and type are required. For VectorTileLayer both styleUrl and type are required. (Added at v3.7)
Known values: "BingMapsAerial" | "BingMapsHybrid" | "BingMapsRoad" | "OpenStreetMap" | "WebTiledLayer" | "VectorTileLayer"