$( document ).ready(function() { // Defaults defaults = { lat: parseFloat($('#map').attr("start_lat")), lng: parseFloat($('#map').attr("start_lon")), zoom: $('#map').attr("start_zoom"), } // Icons var leecherIcon = L.icon({ iconUrl: '../assets/leaflet/images/marker-icon.png', iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [0, -28] }); var seederIcon = L.icon({ iconUrl: '../assets/leaflet/images/marker-icon-red.png', iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [0, -28] }); // Create map var map = L.map('map', {scrollWheelZoom: false}).setView([defaults.lat,defaults.lng], defaults.zoom); L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox', maxZoom: 18 }).addTo(map); // Add scale control L.control.scale({ position: 'bottomleft', metric: true, imperial: false, maxWidth: 200 }).addTo(map); // Get JSON var GeoJsonPath = $('#map').data('json') $.getJSON(GeoJsonPath, function(data){ function buildPopupContent(feature, layer) { feature.properties.popupContent = ''; var featureIdLink = '#' + feature.id + ''; if (feature.properties.name) { feature.properties.popupContent += '

'+featureIdLink+': '+feature.properties.name+'

'; } else { feature.properties.popupContent += '

'+ featureIdLink +'

'; } if (feature.properties.place) { feature.properties.popupContent += ''; } if (feature.properties.email || feature.properties.phone) { feature.properties.popupContent += '