Code Monkey home page Code Monkey logo

maplibre-gl-directions's Introduction

MapLibre Organization

https://www.maplibre.org/

This repository contains various documents that define the MapLibre Organization such as the Charter, our Code of Conduct, the list of Voting Members, and more.

You also find here the results of past Governing Board elections.

Formatting

Markdown files in this repo are formatted with markdownlint. If you have formatting problems you can sometimes fix them with:

npx markdownlint-cli *.md --fix

maplibre-gl-directions's People

Contributors

birkskyum avatar clementmas avatar dependabot[bot] avatar fsss126 avatar miguel-sanches avatar smellyshovel avatar wipfli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

maplibre-gl-directions's Issues

Implement the main directions control

The main control should provide at least 2 fields: one for origin and one for destination. Most probably they should also support geocoding.

If the steps request option is enabled, the control should also display the routing steps and allow to navigate through the waypoints.

To be continued...

nvm

For new contributors, it is nice to tell them which node / npm version is necessary. In GL JS, we have some documentation about using nvm use together with a .nvmrc file which we set to 16 I think. @smellyshovel can you add something like this here as well?

Use placemark's polyline in favor of mapbox's polyline

There's a new polyline package from Placemark:

As highlighted in the readme, it is maintained, it uses [lon, lat] order, it doesn't have any depencencies and it is typed.

Using it would simplify the decoding process from decode(geometry).map((coordinate) => coordinate.reverse()) to decode(geometry).

I'd like to use it in my own codebase but I don't want to use both since Mapbox's package is a dependency of maplibre-gl-directions.

So it'd be great if you would consider switching packages.

Originally posted by @clementmas in #211

Map frozen on touchscreens after calling destroy()

On a touchscreen device, if you drag the the line or a vertex, then remove the directions (call destroy()), it will freeze the map and it won't pan anymore.

Here's the reproduction link:
https://codesandbox.io/s/maplibre-gl-directions-pan-error-s1giw7

  • Open the devtools
  • enable the mobile responsive mode (to simulate touchscreen events)
  • drag the line to add a vertex
  • click on the button "Remove direction"
    -> map is frozen

I think this has to do with with line: https://github.com/maplibre/maplibre-gl-directions/blob/main/src/directions/main.ts#L483

Disable the global onMove handlers for them not to interfere with the new ones which are added further down.

Somehow it stays disabled and creates this bug.

Testing

The most crucial lib's parts should be covered with unit tests. That's the very least requirement till v1.

Write tests for:

  • The lib's public interface
  • Util-methods
  • Helper-methods

Dependabot issues?

Accidentally saw the following at the insights. Seems like something's wrong with Dependabot. @wipfli, could you please check it out?

Screenshot_20220422_004405

Incorrectly-built routes for the cases when there are multiple waypoints in the input data with the same coordinates

To put it all short:

With the existing implementation, everything works just fine as long as none of the coordinates are repeated in the input waypoints data:

        [7.137154, 49.319755], // 1
        [7.148604, 49.315962], // 2
        [7.149873, 49.319595],
        [7.140321, 49.30794],
        [7.153934, 49.317662],
        [7.144149, 49.310097], // 3
        [7.13242, 49.31679],
        [7.146392, 49.317763], // 4
        [7.156454, 49.322832], // 5
        [7.143664, 49.313397], // 6

        // [7.137154, 49.319755], // 1
        // [7.146392, 49.317763], // 4
        // [7.137154, 49.319755], // 1
        // [7.148604, 49.315962], // 2
        // [7.144149, 49.310097], // 3
        // [7.143664, 49.313397], // 6
        // [7.156454, 49.322832], // 5
        // [7.143664, 49.313397], // 6

Screenshot_20230831_153119

Total route geometry:

iw_lHk~pj@sCkIw@qFj@gUbAk@fJuN~AhAzAcF?yApGiCRgAYkCK}Hg@aDEsCVcBcEiA_BmEsBrD?`B`CtGpDfFAlHiCnFmB`CqFgJ?_AmAaC_EoC_C^`H~PtJpHzAcF?yApGiCRgA[}Cl@@^cA`AMp@|DzAvArBT`DhJfEfInIxKhEpL|CpFdFrMZHbEiD_B_C}D}Ic`@qy@wAmNe@YmA^oCKkD_CqFqAu@u@a@^cBkCx@eAXhAfB|CpFpAjD~BnCJ~@t@nAvLz@ExRla@j@lAwEtG{BxO}@dR@zHu@nMcCzHe@pPWLeBw@k@|DoEnDoENqBjAi@ye@_A}g@Ri]k@qEoAyCeA_A^qA`AcDKcBsAxAaBtDyFcEeBuC_HmRk@oDQ_Gy@oDgBgCiBk@IaDNo@fAi@C[y@{C}BiC|BhCz@hDmAfA@`EhBj@fBfCx@nDP~Fj@nD~GlRhApBtJpHzAcF?yApGiCRgA[}Cl@@^cA`AMp@|DzAvArBT`DhJfEfI`DjEkApEkGqF]LEr@

Reference Valhalla:

Screenshot_20230831_153257

Issues begin with uncommenting at least the 11th coordinate (which duplicates the first one):

        [7.137154, 49.319755], // 1
        [7.148604, 49.315962], // 2
        [7.149873, 49.319595],
        [7.140321, 49.30794],
        [7.153934, 49.317662],
        [7.144149, 49.310097], // 3
        [7.13242, 49.31679],
        [7.146392, 49.317763], // 4
        [7.156454, 49.322832], // 5
        [7.143664, 49.313397], // 6

        [7.137154, 49.319755], // 1
        // [7.146392, 49.317763], // 4
        // [7.137154, 49.319755], // 1
        // [7.148604, 49.315962], // 2
        // [7.144149, 49.310097], // 3
        // [7.143664, 49.313397], // 6
        // [7.156454, 49.322832], // 5
        // [7.143664, 49.313397], // 6

The built route looks the same

Screenshot_20230831_153607

Though the total route's geometry's different:

iw_lHk~pj@sCkIw@qFj@gUbAk@fJuN~AhAzAcF?yApGiCRgAYkCK}Hg@aDEsCVcBcEiA_BmEsBrD?`B`CtGpDfFAlHiCnFmB`CqFgJ?_AmAaC_EoC_C^`H~PtJpHzAcF?yApGiCRgA[}Cl@@^cA`AMp@|DzAvArBT`DhJfEfInIxKhEpL|CpFdFrMZHbEiD_B_C}D}Ic`@qy@wAmNe@YmA^oCKkD_CqFqAu@u@a@^cBkCx@eAXhAfB|CpFpAjD~BnCJ~@t@nAvLz@ExRla@j@lAwEtG{BxO}@dR@zHu@nMcCzHe@pPWLeBw@k@|DoEnDoENqBjAi@ye@_A}g@Ri]k@qEoAyCeA_A^qA`AcDKcBsAxAaBtDyFcEeBuC_HmRk@oDQ_Gy@oDgBgCiBk@IaDNo@fAi@C[y@{C}BiC|BhCz@hDmAfA@`EhBj@fBfCx@nDP~Fj@nD~GlRhApBtJpHzAcF?yApGiCRgA[}Cl@@^cA`AMp@|DzAvArBT`DhJfEfI`DjEkApEkGqF]LEr@Sh@L|F`CvPjF_A}@dR@zHu@nMcCzHe@pPWLeBw@k@|DoEnDoENqBjAwAm_AeFfAwCdDaA`@WqDsA_F

What it should look like (ref)

Screenshot_20230831_153754

If we uncomment all the waypoints, thus adding multiple duplicated waypoints, here's what the difference looks like:

Real: total mess with some weird straight lines here and there

Screenshot_20230831_154034

Ref

Screenshot_20230831_154139

ESLint and Prettier auto-fixes are ignored by the build-flow.

In the build-flow there's currently a step that checks and auto-fixes all the code with eslint and prettier. The issue is that the changes are not commited and pushed by the actions bot and therefore they are ignored. This must be addressed at some point 'cause as it is now, it's a waste of resources.

Personal Access Token in CI

@smellyshovel if I remember correctly, CI uses a personal access token somewhere. Is it secrets.GITHUB_TOKEN? It would be great if you could document somewhere what GitHub secrets are used in CI and maybe it would make sense give the personal access token a more explicit name like secrets.MAINTAINER_PAT or so. Thanks!

Handle routing errors?

At the time being it's assumed that the user takes care of the failing routing-requests themselves. E.g. by wrapping the .addWaypoint inside the try-catch block.

Maybe it's worth of providing some default error-handling so that the whole thing doesn't fail in case it's not wrapper in try-catch?

Force install required with [email protected]

I updated a project, bumping maplibre-gl from 3.1.0 to 4.0.0. The package has a peer dependency to maplibre-gl@"^3.0.0" so npm install failed without the use of the --force flag.

  • Note: Everything worked normally after the force installation (screenshot below)
    image

I suppose the upgrade is already in-planning or underway, but I opened the issue in case somebody misses the fix.

MovewapointStart, MoveWaypointEnd Enchancement

Hello,

I'm actively developing a routing application using OSM data, maptiler, OSRM, and svelte. I've enjoyed using this package for just over a month!

I noticed that it would be useful to update some reactive aspects of my application when a user starts and or finishes moving a waypoint. However, I did not find an event like "fetchroutestart, or fetchrouteend" for this case.

Are there current developments to add to the event types? I would be interested in helping develop these enhancements.

Add a request timeout option to cancel requests which are being held in the pending status for more than a specified amount of time

The plugin's interactivity is automatically disabled whenever there's an ongoing Network-request. If the request takes longer than expected, the whole thing severely affects the UX of the plugin.

Therefore, we need to add an option that would allow the user to configure the maximal amount of time a Network-request is allowed to take before it's canceled and the plugin's interactivity is restored back.

Make the Demo project mobile-friendly

There are examples which are tailored specifically for the touch-enabled devices, but the Demo project actually does not provide a good support for the touch-enabled devices. This must be fixed.

Can't drag the map if setting directions.interactive = true

If I setting directions.interactive = true the map can't be moved by dragging

ERROR MESSAGE:

Uncaught TypeError: Cannot read properties of undefined (reading 'source')
at He.onDragDown (main.ts:394:21)
at Map.fire (maplibre-gl.js:31:11764)
at fo._firePreventable (maplibre-gl.js:35:288967)
at fo.mousedown (maplibre-gl.js:35:288284)
at Yo.handleEvent (maplibre-gl.js:35:311286)

DEMO does not have this problem, is it an environment setting error? thx

Introduce a full restyling docs and example

Currently the section about the extensibility-interface is marked a WIP in the API docs. There's also no example for the full restyling.

  • Restyling example
  • Extensibility-interface API docs

Reduce bundle size

The lib's main dist file is currently over 1MB.

We need to reduce it and, possibly, split the lib into chunks: main directions functionality and controls (maybe even each control separately).

Remove a waypoint's related snappoint from the map only after the route is rebuilt

Currently when a waypoint is removed, its related snappoint is removed along with it right away. It doesn't look very beautiful when the route is teared apart at the point where there was a snappoint.

See if maybe it would be possible to remove the related snappoint only after the routes are rebuilt after the server responds with a modified route.

Error `Cannot find module` when using in a Nuxt 2 (webpack) project

Hello!

I'm trying to use this module with a vue project (nuxt 2).
I've installed and used maplibre-gl without problem.

I'm getting the error Cannot find module '@maplibre/maplibre-gl-directions' when I try to load my page.
Here is my code:

import maplibregl from 'maplibre-gl'
import MapLibreGlDirections, { LoadingIndicatorControl } from '@maplibre/maplibre-gl-directions'

export default {
  data() {
    return {
      map: {},
    }
  },
  mounted() {
    this.createMap()
  },
  methods: {
    // MAP INIT
    createMap() {
      this.map = new maplibregl.Map({
        container: 'map',
        style: `https://api.maptiler.com/maps/streets/style.json?key=${this.style_token}`,
        center: this.center,
        zoom: 11,
      })
      this.map.addControl(new maplibregl.NavigationControl(), 'top-left')
      // DIRECTIONS INIT
      this.initDirections()
    },

    initDirections() {
      const directions = new MapLibreGlDirections(this.map)
      directions.interactive = true
      this.map.addControl(new LoadingIndicatorControl(directions))
    },
  },
}

I've tried different ways of initializing the MapLibreGlDirections in the code but it won't change the Cannot find module error.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.