WMS
AMap.TileLayer.WMS
A layer class for loading WMS map services that conform to OGC standards, only supports WMS layers with the EPSG3857 coordinate system
Construct a WMS layer object, set the layer properties through WMSLayerOptions
new AMap.TileLayer.WMS(opts: WMSLayerOptions)Parameter
opts(WMSLayerOptions): WMS Layer Parameters
Demo
//Creating a standard WMS layer
var wms = new AMap.TileLayer.WMS({
url: "https://ahocevar.com/geoserver/wms", //URL address of the WMS service
blend: false, //Whether images of different levels are blended when switching map levels
tileSize: 512, //Tile size of the images when loading WMS layer services
params: {
LAYERS: "topp:states",
VERSION: "1.3.0",
}, //Parameters of the GetMap interface for OGC standard WMS map services
});
map.add(wms); //Add layers to the mapMethod
setParams(params)
Set parameters of the OGC standard WMS getMap interface, including VERSION, LAYERS, STYLES, FORMAT, TRANSPARENT, etc.
Parameter: params(Object) Parameter collection,{VERSION: '1.0', ...}
Demo:
wms.setParams({
LAYERS: "topp:states",
VERSION: "1.3.0",
});getParams()
Obtain parameters of the OGC standard WMS getMap interface
return value: (object) Interface Parameters
Demo:
wms.getParams();setUrl(url)
Set WMS Service Address
Parameter: url (String) Service Address
Demo:
wms.setUrl("https://ahocevar.com/geoserver/wms");getOptions()
Get Layer Parameter Information
return value: (Object) Layer Parameter Information
Demo:
wms.getOptions();setzIndex(zIndex)
Set the layer hierarchy, the larger the number, the higher the layer hierarchy
Parameter: zIndex (Number) Layer hierarchy value
Demo:
wms.setzIndex(10);getOpacity()
Get layer transparency
return value: (Number) Opacity layer opacity
Demo:
wms.getOpacity();setOpacity(opacity)
Set the layer opacity, range [0 ~ 1], 1 means completely opaque, 0 means completely transparent
Parameter: opacity (Number) Layer opacity
Demo:
wms.setOpacity(0.5);getZooms()
Get the level range that this layer can display, default range: [2-30]
return value: ([Number, Number]) The level range that this layer can display
Demo:
wms.getZooms();setZooms(zooms)
Set the Level Range of the Layer
Parameter: zooms([Number, Number]) The Zoom Range of the Layer
Demo:
wms.setZooms([8,12]);show()
Set Layer Visible
Demo:
wms.show();hide()
Set Layer Hidden
Demo:
wms.hide();Event
For event object property descriptions, go to:MapsEvent