|
@@ -149,34 +149,19 @@ function setupMap() {
|
|
|
else map.addLayer(placesMarkerLayer);
|
|
else map.addLayer(placesMarkerLayer);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- // var mapillaryKey = 'SmRiZXFSN3RJYVpKdGd2V3BQZ0dMdzoxZjY3YjA3MmU2OWU2ODll';
|
|
|
|
|
- // map.on('contextmenu ', function (event) {
|
|
|
|
|
- // console.log(event);
|
|
|
|
|
-
|
|
|
|
|
- // var popup = L.popup({ closeButton: false })
|
|
|
|
|
- // .setLatLng(event.latlng)
|
|
|
|
|
- // .setContent('<p>Loading address</p>')
|
|
|
|
|
- // .openOn(map);
|
|
|
|
|
-
|
|
|
|
|
- // var params = {
|
|
|
|
|
- // client_id: mapillaryKey,
|
|
|
|
|
- // closeto: event.latlng.lng + ',' + event.latlng.lat,
|
|
|
|
|
- // pano: false
|
|
|
|
|
- // };
|
|
|
|
|
-
|
|
|
|
|
- // axios.get('https://a.mapillary.com/v3/images', {
|
|
|
|
|
- // params: params
|
|
|
|
|
- // }).then(function (response) {
|
|
|
|
|
- // // console.log(response.data);
|
|
|
|
|
- // if (response.data.features.length === 0) {
|
|
|
|
|
- // popup.setContent('<p>Nothing found</p>');
|
|
|
|
|
- // } else {
|
|
|
|
|
- // popup.setContent('<div class="whats-here" style="background-image: url(https://d1cuyjsrcm0gby.cloudfront.net/' + response.data.features[0].properties.key + '/thumb-640.jpg"></div>');
|
|
|
|
|
- // }
|
|
|
|
|
- // }).catch(function (error) {
|
|
|
|
|
- // console.error(error);
|
|
|
|
|
- // });
|
|
|
|
|
- // });
|
|
|
|
|
|
|
+ map.on('contextmenu ', function (event) {
|
|
|
|
|
+ var menu = document.getElementById('contextMenu');
|
|
|
|
|
+
|
|
|
|
|
+ function contextMenuDismissHandler() {
|
|
|
|
|
+ menu.classList.remove('visible');
|
|
|
|
|
+ document.removeEventListener('click', contextMenuDismissHandler);
|
|
|
|
|
+ }
|
|
|
|
|
+ document.addEventListener('click', contextMenuDismissHandler);
|
|
|
|
|
+
|
|
|
|
|
+ menu.classList.add('visible');
|
|
|
|
|
+ menu.style.left = event.originalEvent.clientX + 'px';
|
|
|
|
|
+ menu.style.top = event.originalEvent.clientY + 'px';
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
// watch for position updates
|
|
// watch for position updates
|
|
|
navigator.geolocation.watchPosition(function (pos) {
|
|
navigator.geolocation.watchPosition(function (pos) {
|
|
@@ -217,7 +202,7 @@ app = new Vue({
|
|
|
var that = this;
|
|
var that = this;
|
|
|
|
|
|
|
|
var params = {
|
|
var params = {
|
|
|
- name: item.name,
|
|
|
|
|
|
|
+ name: item.display_name,
|
|
|
lat: item.lat,
|
|
lat: item.lat,
|
|
|
lon: item.lon,
|
|
lon: item.lon,
|
|
|
class: item.class
|
|
class: item.class
|
|
@@ -246,7 +231,7 @@ app = new Vue({
|
|
|
icon: DEFAULT_MARKER_ICON,
|
|
icon: DEFAULT_MARKER_ICON,
|
|
|
opacity: 0.5
|
|
opacity: 0.5
|
|
|
});
|
|
});
|
|
|
- m.bindTooltip(item.name, { direction: 'bottom' });
|
|
|
|
|
|
|
+ m.bindTooltip(item.display_name, { direction: 'bottom' });
|
|
|
m.on('click', function (e) {
|
|
m.on('click', function (e) {
|
|
|
that.openPlaceDetails(item);
|
|
that.openPlaceDetails(item);
|
|
|
that.activateSearchMarker(item);
|
|
that.activateSearchMarker(item);
|
|
@@ -286,15 +271,43 @@ app = new Vue({
|
|
|
this.sidePanelBusy = true;
|
|
this.sidePanelBusy = true;
|
|
|
|
|
|
|
|
var params = {
|
|
var params = {
|
|
|
- search: this.querySearchString,
|
|
|
|
|
- lat: map.getCenter().lat,
|
|
|
|
|
- lon: map.getCenter().lng
|
|
|
|
|
|
|
+ q: this.querySearchString,
|
|
|
|
|
+ addressdetails: 1,
|
|
|
|
|
+ extratags: 1,
|
|
|
|
|
+ format: 'json'
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- axios.get('/api/places', {
|
|
|
|
|
|
|
+ axios.get('https://nominatim.openstreetmap.org/search', {
|
|
|
params: params
|
|
params: params
|
|
|
}).then(function (response) {
|
|
}).then(function (response) {
|
|
|
|
|
+ console.log(response.data)
|
|
|
|
|
+
|
|
|
that.querySearchResults = response.data;
|
|
that.querySearchResults = response.data;
|
|
|
|
|
+ that.querySearchResults.forEach(function (d) {
|
|
|
|
|
+ // icons
|
|
|
|
|
+ d.icon = 'fa-address-card';
|
|
|
|
|
+ if (d.type === 'fast_food' || d.type === 'restaurant') d.icon = 'fa-utensils';
|
|
|
|
|
+ if (d.type === 'doctors') d.icon = 'fa-user-md';
|
|
|
|
|
+ if (d.type === 'beach') d.icon = 'fa-umbrella-beach';
|
|
|
|
|
+ if (d.type === 'dentist') d.icon = 'fa-tooth';
|
|
|
|
|
+ if (d.type === 'car') d.icon = 'fa-car';
|
|
|
|
|
+ if (d.type === 'playground') d.icon = 'fa-child';
|
|
|
|
|
+ if (d.type === 'recreation_ground') d.icon = 'fa-running';
|
|
|
|
|
+ if (d.type === 'sports_centre' || d.type === 'pitch') d.icon = 'fa-futbol';
|
|
|
|
|
+ if (d.type === 'bicycle-rental') d.icon = 'fa-bicycle';
|
|
|
|
|
+ if (d.type === 'school') d.icon = 'fa-graduation-cap';
|
|
|
|
|
+ if (d.type === 'post_box' || d.type === 'post_office') d.icon = 'fa-envelope-square';
|
|
|
|
|
+ if (d.type === 'canal' || d.type === 'river' || d.type === 'water') d.icon = 'fa-water';
|
|
|
|
|
+ if (d.type === 'station' || d.type === 'stop' || d.type === 'bus_stop') d.icon = 'fa-subway';
|
|
|
|
|
+ if (d.type === 'attraction') d.icon = 'fa-monument';
|
|
|
|
|
+ if (d.type === 'city' || d.type === 'village' || d.type === 'town' || d.type === 'hamlet') d.icon = 'fa-city';
|
|
|
|
|
+ if (d.type === 'administrative' || d.class === 'office') d.icon = 'fa-building';
|
|
|
|
|
+ if (d.type === 'pub' || d.type === 'bar') d.icon = 'fa-beer';
|
|
|
|
|
+ if (d.type === 'nightclub') d.icon = 'fa-glass-cheers';
|
|
|
|
|
+ if (d.type === 'hotel' || d.type === 'hostel') d.icon = 'fa-bed';
|
|
|
|
|
+ if (d.type === 'supermarket' || d.type === 'retail') d.icon = 'fa-shopping-cart';
|
|
|
|
|
+ if (d.class === 'highway') d.icon = 'fa-road';
|
|
|
|
|
+ });
|
|
|
that.sidePanelBusy = false;
|
|
that.sidePanelBusy = false;
|
|
|
|
|
|
|
|
that.addSearchMarker(that.querySearchResults);
|
|
that.addSearchMarker(that.querySearchResults);
|
|
@@ -302,6 +315,31 @@ app = new Vue({
|
|
|
console.error(error);
|
|
console.error(error);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ // searchPlaces: function () {
|
|
|
|
|
+ // var that = this;
|
|
|
|
|
+
|
|
|
|
|
+ // this.querySearchResults = [];
|
|
|
|
|
+ // this.markerDetailsOpen = false;
|
|
|
|
|
+ // this.sidePanelOpen = true;
|
|
|
|
|
+ // this.sidePanelBusy = true;
|
|
|
|
|
+
|
|
|
|
|
+ // var params = {
|
|
|
|
|
+ // search: this.querySearchString,
|
|
|
|
|
+ // lat: map.getCenter().lat,
|
|
|
|
|
+ // lon: map.getCenter().lng
|
|
|
|
|
+ // };
|
|
|
|
|
+
|
|
|
|
|
+ // axios.get('/api/places', {
|
|
|
|
|
+ // params: params
|
|
|
|
|
+ // }).then(function (response) {
|
|
|
|
|
+ // that.querySearchResults = response.data;
|
|
|
|
|
+ // that.sidePanelBusy = false;
|
|
|
|
|
+
|
|
|
|
|
+ // that.addSearchMarker(that.querySearchResults);
|
|
|
|
|
+ // }).catch(function (error) {
|
|
|
|
|
+ // console.error(error);
|
|
|
|
|
+ // });
|
|
|
|
|
+ // }
|
|
|
},
|
|
},
|
|
|
created: function () {
|
|
created: function () {
|
|
|
var that = this;
|
|
var that = this;
|