Skip to content

Instantly share code, notes, and snippets.

@tetrashine
Created March 7, 2021 08:07
Show Gist options
  • Select an option

  • Save tetrashine/09ba26b2594f8ce1f7ff0b6d4df85c80 to your computer and use it in GitHub Desktop.

Select an option

Save tetrashine/09ba26b2594f8ce1f7ff0b6d4df85c80 to your computer and use it in GitHub Desktop.
map-dashboard.js
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: '&copy; <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