diff --git a/web/app/scripts/views/map/layers-controller.js b/web/app/scripts/views/map/layers-controller.js index a42b593f..a0d9ea38 100755 --- a/web/app/scripts/views/map/layers-controller.js +++ b/web/app/scripts/views/map/layers-controller.js @@ -677,7 +677,7 @@ new L.popup(popupOptions) .setLatLng(e.latlng) - .setContent(ctl.buildBlackspotPopup(e.data)) + .setContent(ctl.buildBlackspotPopup(e.data, e.latlng)) .openOn(ctl.map); $compile($('#blackspot-popup'))($scope); @@ -690,9 +690,22 @@ * @param {Object} UTFGrid interactivity data from interaction event object * @returns {String} HTML snippet for a Leaflet popup */ - ctl.buildBlackspotPopup = function(blackspot) { + ctl.buildBlackspotPopup = function(blackspot, e.latlng) { /* jshint camelcase: false */ + var url = "https://a.mapillary.com/v3/images?lookat=" + e.latlng.lng + "," + e.latlng.lat + "&closeto=" + e.latlng.lng + "," + e.latlng.lat + "&client_id=UTZhSnNFdGpxSEFFREUwb01GYzlXZzo5ZWIxZWYxNzM1YWY2MjNm&radius=400"; + var imgkey; + var mly; + $.ajax({ + dataType: 'json', + url: url, + success: function (data) { + imgkey = data.images[0]["key"]; + mly = ''; + }, + async: false + }); var str = '