Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // initmapa.js
- var osmUrl = '';
- var osmAttrib = '';
- var mapa = null;
- function loadMapa()
- {
- osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
- osmAttrib = osmAttrib='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
- mapa = L.map('map').setView([-34.9053694,-56.2072348], 13); // mapa var global
- L.tileLayer(osmUrl, {
- attribution: osmAttrib,
- minZoom: 8,
- maxZoom: 18,
- }).addTo(mapa);
- };
- function loadEstacionesDeServicio()
- {
- var infladores = omnivore.kml('Mapas/infladores.kml').on('ready', function() {
- mapa.fitBounds(infladores.getBounds());
- }).addTo(mapa);
- };
- index.html
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Mapa simple</title>
- <link rel="stylesheet" href="leaflet.css" />
- <link rel="stylesheet" href="css/mapa.css">
- <script src="leaflet.js"></script>
- <script src='js/leaflet-omnivore.min.js'></script>
- </head>
- <body>
- <div id="map"></div>
- <script src="js/initmapa.js"></script>
- <script>
- loadMapa();
- loadEstacionesDeServicio()
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement