May 2017
Beginner to intermediate
328 pages
7h 17m
English
Map declaration in Leaflet is very similar to what we did with OpenLayers:
/** * Create map * @param mapContainerId */ createMap: function(mapContainerId){ this.map = new L.Map(mapContainerId, { crs: L.CRS.EPSG4326, layers: this.createLayers() }).setView([-15,155], 4); L.control.scale().addTo(this.map); }
The preceding code creates a Leaflet Map instance and renders it into the specified container. Layers are declared in another method:
/** * creates layers for the map * @returns {[*]} */ createLayers: function(){ return [ L.tileLayer.wms('http://localhost:8081', { layers: 'ne_raster', version: '1.1.1', format: 'image/png', transparent: true, maxZoom: 8, minZoom: 0, continuousWorld: true, Read now
Unlock full access