GeoOperations.distanceBetween now uses meters, fix GPS tracking

This commit is contained in:
Pieter Vander Vennet 2021-11-12 18:39:38 +01:00
parent 79012c42ab
commit 680e56397d
10 changed files with 40 additions and 40 deletions

View file

@ -136,7 +136,7 @@ export default class LengthInput extends InputElement<string> {
if (leaflet) {
const first = leaflet.layerPointToLatLng(firstClickXY)
const last = leaflet.layerPointToLatLng([dx, dy])
const geoDist = Math.floor(GeoOperations.distanceBetween([first.lng, first.lat], [last.lng, last.lat]) * 10000) / 10
const geoDist = Math.floor(GeoOperations.distanceBetween([first.lng, first.lat], [last.lng, last.lat]) * 10) / 10
self.value.setData("" + geoDist)
}

View file

@ -93,7 +93,7 @@ export default class SplitRoadWizard extends Toggle {
function onMapClick(coordinates) {
// First, we check if there is another, already existing point nearby
const points = splitPoints.data.map((f, i) => [f.feature, i])
.filter(p => GeoOperations.distanceBetween(p[0].geometry.coordinates, coordinates) * 1000 < 5)
.filter(p => GeoOperations.distanceBetween(p[0].geometry.coordinates, coordinates) < 5)
.map(p => p[1])
.sort((a, b) => a - b)
.reverse()