From f140d596986923ac37c0721ef2d8320ca81ae7e9 Mon Sep 17 00:00:00 2001 From: Mihkel Oviir Date: Fri, 11 Jan 2019 00:37:19 +0200 Subject: [PATCH] Routing fix --- src/geop/components/routing/Routing.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/geop/components/routing/Routing.js b/src/geop/components/routing/Routing.js index e3691a1..f198b77 100644 --- a/src/geop/components/routing/Routing.js +++ b/src/geop/components/routing/Routing.js @@ -6,7 +6,7 @@ import log from 'Utilities/log' import { uid } from 'Utilities/util' import { createMarker } from 'Components/mouseposition/MousePosition' import { createLayer } from 'Components/layer/LayerCreator' -import { toLonLat } from 'ol/proj' +import { toLonLat, fromLonLat } from 'ol/proj' import Polyline from 'ol/format/Polyline' import $ from 'jquery' @@ -87,8 +87,8 @@ class Routing extends Component { const coords = getState('routing/stops') findRoute(coords).then(route => { const routeCoords = route.getGeometry().getCoordinates() - routeCoords.unshift(this.state.from) - routeCoords.push(this.state.to) + routeCoords.unshift(fromLonLat(coords[0], getState('map/projection'))) + routeCoords.push(fromLonLat(coords[coords.length - 1], getState('map/projection'))) route.getGeometry().setCoordinates(routeCoords) }).catch(e => {}) }