Skip to content

Commit 6972598

Browse files
committed
Fix geolocation
a valle dell'installazione del certificato: - disabilitata esclusione explorer - arrotondamento coordinate per reverse - reverse geocoding su geoloc api
1 parent b582cf8 commit 6972598

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

src/client/js/otp/core/GeocoderPelias.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ otp.core.GeocoderPelias = otp.Class({
6565
reverse : function(latlng, callback) {
6666
var params = {};
6767
//params[this.addressParam] = address;
68-
params['lat'] = latlng.lat;
69-
params['lng'] = latlng.lng;
68+
params['lat'] = (Math.round(latlng.lat*100000)/100000);
69+
params['lng'] = (Math.round(latlng.lng*100000)/100000);
7070
var this_ = this;
7171
var revUrl = this.url.replace('suggest','reverse')
7272

src/client/js/otp/core/Map.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ otp.core.Map = otp.Class({
103103
icon: 'fa fa-location-arrow', // class for icon, fa-location-arrow or fa-map-marker
104104
follow: true,
105105
});
106-
if(! /Edge\/|Trident\/|MSIE /.test(window.navigator.userAgent)){
106+
//if(! /Edge\/|Trident\/|MSIE /.test(window.navigator.userAgent))
107107
this.lmap.lc = L.control.locate().addTo(this.lmap);
108-
}
109108

110109

111110
//this.lmap.addControl(new L.Control.Zoom({ position : 'topright' }));

src/client/js/otp/widgets/tripoptions/TripOptionsWidget.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,20 @@ otp.widgets.tripoptions.LocationsSelector =
260260
var lmap = this.tripWidget.module.webapp.map.lmap;
261261

262262
function setStartPointByLocation(e){
263-
module.webapp.activeModule.setStartPoint(e.latlng, true);
264-
lmap.off('locationfound', setStartPointByLocation);
263+
this_.geocoders[0].reverse(e.latlng, function(result) {
264+
console.log("got result: "+ result);
265+
module.webapp.activeModule.setStartPoint(e.latlng, true, result);
266+
});
267+
//module.webapp.activeModule.setStartPoint(e.latlng, true);
268+
lmap.off('locationfound', setStartPointByLocation);
265269
}
266270
function setEndPointByLocation(e){
267-
module.webapp.activeModule.setEndPoint(e.latlng, true);
268-
lmap.off('locationfound', setEndPointByLocation);
271+
this_.geocoders[0].reverse(e.latlng, function(result) {
272+
console.log("got result: "+ result);
273+
module.webapp.activeModule.setEndPoint(e.latlng, true, result);
274+
});
275+
//module.webapp.activeModule.setEndPoint(e.latlng, true);
276+
lmap.off('locationfound', setEndPointByLocation);
269277
}
270278

271279
$('#mylocation-start').click($.proxy(function(){

0 commit comments

Comments
 (0)