Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snippet: Adding waypoints to a route between start and finish #11

Open
trasherdk opened this issue Nov 24, 2022 · 0 comments
Open

Snippet: Adding waypoints to a route between start and finish #11

trasherdk opened this issue Nov 24, 2022 · 0 comments

Comments

@trasherdk
Copy link
Owner

Doing it programmatically, with data from some source:

const start = L.latLng(
        startingPoints[0]?.highestEl?.latlng?.lat,
        startingPoints[0]?.highestEl?.latlng?.lng);
const end =  L.latLng(
        startingPoints[0]?.lowestEl?.latlng?.lat,
        startingPoints[0]?.lowestEl?.latlng?.lng
      );
const middle =  L.latLng(
        startingPoints[0]?.middleEl?.latlng?.lat,
        startingPoints[0]?.middleEl?.latlng?.lng
      );
const instance = L.Routing.control({
    waypoints: [
     start,
      end,
    ],
  });

instance.setWaypoints([start, middle, end]);

Source: perliedman#663 (comment)

Doing it manually, using a nice UI: Adding waypoints by clicking the map example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant