function showCropMap(cropmap) { L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors', maxZoom: 18 }).addTo(cropmap); var markers = new L.MarkerClusterGroup({showCoverageOnHover: false, maxClusterRadius: 20 }); var crop_icon = L.icon({ iconUrl: location.pathname + '.svg', iconSize: [24, 24], iconAnchor: [12, 12], popupAnchor: [0, -12], }); var things_to_map = location.pathname + '.json'; $.getJSON(things_to_map, function(crop) { $.each(crop.plantings, function(i, planting) { var owner = planting.owner; if (owner.latitude && owner.longitude) { var marker = new L.Marker(new L.LatLng(owner.latitude, owner.longitude), {'icon': crop_icon}); var planting_url = "/plantings/" + planting.id; var planting_link = "" + owner.login_name + "'s " + crop.name + ""; var where = "
" + owner.location + "
"; var details = "";
if (planting.quantity) {
details = details + "Quantity: " + planting.quantity + "
";
}
if (planting.planted_from) {
details = details + "Planted from: " + planting.planted_from + "
";
}
if (planting.sunniness) {
details = details + "Planted in: " + planting.sunniness+ "
";
}
details = details + "