Get started with leaflet-omnivore CDN
BSD-3-Clause licensed
Leaflet-omnivore: library, extends Leaflet.js for geocoding/reverse from OpenStreetMap, Google, Bing.
Tags:- leaflet
- formats
- kml
- csv
- gpx
- geojson
- maps
- wkt
- osm
- polyline
- topojson
- format
- converter
Stable version
Copied!
How to start using leaflet-omnivore CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with leaflet-omnivore CDN - cdnhub.io</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/leaflet/1.7.1/leaflet.css"/>
<script src="https://cdn.jsdelivr.net/leaflet/1.7.1/leaflet.js"></script>
<script src="https://cdn.cdnhub.io/leaflet-omnivore/0.3.4/leaflet-omnivore.min.js"></script>
<style>
#mapid { height: 400px; width: 100%; }
</style>
</head>
<body>
<div id="mapid"></div>
<script>
const map = L.map('mapid').setView([51.505, -0.09], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors',
maxZoom: 19
}).addTo(map);
L.omnivore.geocoder()
.addTo(map)
.search('London, UK')
.then(results => {
const marker = L.marker(results[0].latlng)
.addTo(map)
.bindPopup(results[0].formattedAddress);
});
</script>
</body>
</html>
Copied!
Copied!