UNPKG

core-resource-app-test

Version:

App that contains assets and scripts for the core apps

47 lines (41 loc) 1.56 kB
<!DOCTYPE html> <html> <head> <title>Adding Pelias geocoding to a basic Leaflet map (v1 beta).</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 --> <script src='https://api.mapbox.com/mapbox.js/v2.2.2/mapbox.js'></script> <link href='https://api.mapbox.com/mapbox.js/v2.2.2/mapbox.css' rel='stylesheet'> <!-- With leaflet-hash --> <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-hash/0.2.1/leaflet-hash.min.js"></script> <!-- Load Pelias 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"> <style> .leaflet-pelias-control:not(.leaflet-pelias-expanded), .leaflet-touch .leaflet-pelias-control:not(.leaflet-pelias-expanded) { width: 28px; height: 28px; } .leaflet-pelias-results { margin-left: -1px; margin-right: 1px; width: calc(100% + 2px); margin-top: -4px; } </style> </head> <body> <div id="map"></div> <script> // Create a basic Leaflet map (with URL hash enabled) L.mapbox.accessToken = 'pk.eyJ1IjoibG91IiwiYSI6IkJDYlg3REEifQ.9BLp9eUdT11kUy1jgujSsQ'; var map = L.mapbox.map('map', 'mapbox.streets'); var hash = new L.Hash(map); // Add Pelias geocoding plugin var geocoder = L.control.geocoder('search-MKZrG6M').addTo(map); </script> </body> </html>