Created
March 7, 2021 08:07
-
-
Save tetrashine/09ba26b2594f8ce1f7ff0b6d4df85c80 to your computer and use it in GitHub Desktop.
map-dashboard.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('leaflet'); | |
| var WMS = require('leaflet.wms'); | |
| window.onload = function() { | |
| // initialize the map on the "map" div with a given center and zoom | |
| var map = L.map('map', { | |
| center: new L.LatLng(1.355, 103.84), | |
| zoom: 13, | |
| }); | |
| //add basemap | |
| L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { | |
| attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', | |
| maxZoom: 18, | |
| }).addTo(map); | |
| //add map service | |
| var layer = WMS.overlay("http://localhost:8080/geoserver/cite/wms?", { | |
| layers: 'cite:assets_location', | |
| format: 'image/png', | |
| transparent: true, | |
| }); | |
| layer.addTo(map); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment