Document Maps JavaScript API Advanced Tutorial Layer Standard Layer

Standard Layer

This article introduces how to use the standard layers provided by Amap.

Standard Layer Example

Standard Layer

You can declare and create a standard layer as follows, then set the layers property of the map object and add it to the map.

//Create a standard layer
var layer = new AMap.createDefaultLayer({
  zooms: [3, 20], //Visibility level
  visible: true, //Visibility
  opacity: 1, 
  zIndex: 0, 
});
//Add layers to the map
var map = new AMap.Map("container", {
  layers: [layer], //Array of map layers
});
Prompt

The Layers property is an array used to set the map layers, which can contain one or more layers. This property is optional. If not specified, the JS API will add a standard layer by default.

var map = new AMap.Map('container');