Questions tagged [leaflet-routing-machine]

Leaflet Routing Machine is an easy, flexible and extensible way to add routing to a Leaflet map. Using the default is just a few lines of code to add fully functional routing, but you can still customize almost every aspect of the user interface and interactions.

84 questions
6
votes
1 answer

How to use Leaflet Routing Machine with React-Leaflet 3?

The old way of doing things in react-leaflet 2.8.0 was to use MapLayer and withLeaflet. But now in react-leaflet: MapLayer and withLeaflet are deprecated as of version 3. I'm trying to grasp the documentation for core:…
lys
  • 949
  • 2
  • 9
  • 33
5
votes
2 answers

How to include leaflet-routing-machine into angular 2 typescript webpack application

I used this seed to get started with Angular 2 Typescript and Webpack: https://github.com/haoliangyu/angular2-leaflet-starter. I'm new to most of the used tools and technologies (Angular 2, Typescript, Webpack). While I understand more and more…
4
votes
1 answer

React-Leaflet/React-Routing-Machine: Remove route and waypoints

I am using the following packages for my map: "leaflet-routing-machine": "^3.2.12", "leaflet": "^1.7.1", "react-leaflet": "^2.7.0", Essentially I have a Routing machine component which I've integrated with my Map and Markers i.e. (upon…
4
votes
1 answer

How can I get the distance and time from L.Routing.control?

I am drawing a route on a leaflet map, it works good and in the control it shows the distance and estimated time of arrival. Is there a way to extract both of them and save them? The code for the L.Routing.control function getroute()…
larry chambers
  • 473
  • 1
  • 6
  • 19
4
votes
2 answers

How to replace default marker to custom icon in waypoint (Leaflet Routing)

Here, I am drawing route and assigning stop to route using Leaflet Routing Machine Leaflet Routing Machine var control = L.Routing.control(L.extend(window.lrmConfig, { waypoints: [array object of stops], geocoder:…
Bhavesh Chauhan
  • 1,023
  • 1
  • 11
  • 30
3
votes
2 answers

Routing control name and add custom markers

Hi I am trying to add custom markers using leaflet and drawing the route using Routing.control. I need to add a variable to markers to, as I need to update one of the marker positions from time to time. I will only ever have 3 marker or waypoints, a…
larry chambers
  • 473
  • 1
  • 6
  • 19
2
votes
1 answer

Is there a way to add "Snap to road" in react leaflet?

I am looking for way to make all the polylines between each of my markers "snap to road" rather than being a direct line drawn between point a and b. So between any two points, i would like the points to be automatically placed on the closest road…
Kuda
  • 95
  • 1
  • 9
2
votes
0 answers

Leaflet map live route tracking

I'm doing an Uber-like app. There is no problem in live tracking, but when I need to direct the vehicle somewhere, there are 3 markers on the map. 1st marker live tracking. The 2nd is the starting point and the 3rd marker is the target. Normally,…
2
votes
0 answers

Leaflet-routing-machine: Is there a way to load waypoints if they have been saved in some kind of data store?

I followed this great tutorial, add because of it was able to add it to my routing machine; However, I'd like to save the waypoints in local-storage and load them when needed. I tried this when creating my Routing Machine: if (map && !this.control)…
Antonio Pavicevac-Ortiz
  • 7,239
  • 17
  • 68
  • 141
2
votes
0 answers

Leaflet-Routing-Machine: TypeError: Cannot read property 'getSize' of undefined

Not sure how this can be happening as I am using useRef to pass a reference of my map to the Routing Machine component... But first here are my dependencies... "react-leaflet": "^2.7.0", "leaflet": "^1.7.1", …
2
votes
1 answer

How to change the default color of leaflet-routing-machine marker

I'am using leaflt-routing-machine plugin, and I need to change color of markers from blue to red, any suggestion please ?!
2
votes
1 answer

Open Route Service - LRM

ive been struggeling for awhile with this, so i got two questions to ask. First question:i cant change the profile on open route service. my code is working when i put in the api-key in the code below. var control; function tests() { var…
2
votes
0 answers

How can I select which waypoints have markers attached?

Background I'm currently working on a project where when a location is selected from a dropdown, or similar input, a marker is inserted onto a map at the corresponding coordinates. It also supports navigation between selected points. These points…
Chase Ingebritson
  • 1,559
  • 1
  • 12
  • 25
2
votes
0 answers

Is there a way to add two different colors on a route (path) if I have 3 wayPoints? leaflet routing machine

If I call a segment as line/route between two way-points. and suppose if I have three way-points then can I have a different color on each segment? If so how can I achieve it? thanks
2
votes
3 answers

Setting language option in Leaflet.Routing.Control

UPDATED: I am trying to translate the leaflet routing component with language:'sp' but it does not work for me. const createRoutingControl = () => { L.Routing.control({ router: L.Routing.mapbox(config.features.routing.key), plan:…
ABT
  • 187
  • 5
  • 15
1
2 3 4 5 6