From 9764fba35cdac7e226dad65f061c09fd3d9909cc Mon Sep 17 00:00:00 2001 From: Kumar Damani Date: Thu, 28 Feb 2019 10:32:26 -0700 Subject: displaying all the fields in the marker popup, better var naming --- web/public/javascripts/map.js | 5 +++-- web/views/map.pug | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/web/public/javascripts/map.js b/web/public/javascripts/map.js index 70c1419..190307d 100644 --- a/web/public/javascripts/map.js +++ b/web/public/javascripts/map.js @@ -12,11 +12,12 @@ L.tileLayer('https://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}{r} ext: 'png' }).addTo(map); -L.geoJson(dumbpoints, { +L.geoJson(points, { pointToLayer: function (feature, latlng) { //return L.circleMarker(latlng); return L.marker(latlng); } }).bindPopup(function (layer) { - return layer.feature.geometry.another; + // layer.feature.geometry gives you access to all the fields + return "

" + JSON.stringify(layer.feature.geometry) + "

"; }).addTo(map) diff --git a/web/views/map.pug b/web/views/map.pug index fcc3abc..725c8a8 100644 --- a/web/views/map.pug +++ b/web/views/map.pug @@ -6,6 +6,6 @@ block content script(type='text/javascript'). var map = L.map('map').setView([#{lat},#{lng}], 13); - var dumbpoints = !{JSON.stringify(points)}; - //console.log(dumbpoints); + var points = !{JSON.stringify(points)}; + console.log(points); script(src='/javascripts/map.js') -- cgit v1.2.3