Last active
October 24, 2019 16:19
-
-
Save iamtekson/787be37c83aeb1d7b06060d9abc0dc18 to your computer and use it in GitHub Desktop.
Geoserver WMS feature with leaflet.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
<html> | |
<head> | |
<!-- leaflet css --> | |
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"> | |
<style> | |
#map { | |
width: 100%; | |
height: 500px; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="map"></div> | |
<!-- leaflet js --> | |
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script> | |
<script> | |
var map = L.map("map").setView([38.45, 70.6], 6); | |
var osm = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { | |
attribution: | |
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' | |
}).addTo(map); | |
//load geojson form geoserver | |
var mywms = L.tileLayer.wms("http://localhost:8080/geoserver/tajikistan/wms", { | |
layers: 'tajikistan:country1', | |
format: 'image/png', | |
transparent: true, | |
version: '1.1.0', | |
attribution: "country layer" | |
}); | |
mywms.addTo(map); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment