core-resource-app-test
Version:
App that contains assets and scripts for the core apps
40 lines (34 loc) • 1.44 kB
HTML
<html>
<head>
<title>Adding two geocoders.</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<!-- Load Leaflet from CDN -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.5/leaflet.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.5/leaflet.js"></script>
<!-- Load geocoding plugin after Leaflet -->
<link rel="stylesheet" href="../dist/leaflet-geocoder-mapzen.css">
<script src="../dist/leaflet-geocoder-mapzen.js"></script>
<link rel="stylesheet" href="assets/examples.css">
</head>
<body>
<div id="map"></div>
<script>
// Create a basic Leaflet map
var map = L.map('map').setView([40.7259, -73.9805], 12);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}).addTo(map);
// Add geocoding plugin
var options = {
expanded: true
}
var geocoder1 = L.control.geocoder('search-MKZrG6M', options).addTo(map);
var geocoder2 = L.control.geocoder('search-MKZrG6M', options).addTo(map);
// Increase the z-index on the first geocoder to make results overlap
// the second geocoder input box.
document.querySelectorAll('.leaflet-pelias-control')[0].style.zIndex = 811;
</script>
</body>
</html>