mirror of
https://github.com/jlengrand/leaflet-geosearch.git
synced 2026-03-10 08:31:26 +00:00
34 lines
952 B
HTML
34 lines
952 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Leaflet.GeoSearch / OSM Provider</title>
|
|
|
|
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
|
|
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
|
|
|
|
<script src="../dist/geosearch.js"></script>
|
|
<link rel="stylesheet" href="../assets/css/leaflet.css" />
|
|
</head>
|
|
<body>
|
|
<div id="map" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></div>
|
|
|
|
<script type="text/javascript">
|
|
const { GeoSearchControl, OpenStreetMapProvider } = window.GeoSearch;
|
|
|
|
const osmTileUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
|
const basemap = new L.TileLayer(osmTileUrl, { maxZoom: 18 });
|
|
|
|
const map = new L.Map('map', {
|
|
layers: [basemap],
|
|
center: new L.LatLng(53.2, 5.8), zoom: 12
|
|
});
|
|
|
|
const provider = new OpenStreetMapProvider();
|
|
new GeoSearchControl({
|
|
provider
|
|
}).addTo(map);
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|