Skip to content

Map zooms to both the info bbox and the route bbox if url contains points #162

Closed

Description

@easbar

Loading a url like: https://graphhopper.com/maps2/?point=51.311911%2C10.205488&point=51.332152%2C10.260636&profile=car&layer=MapTiler

triggers a request to the /info endpoint as well as a request to the /route endpoint. These requests result in InfoReceived and RouteRequestSuccess actions, for both of which we update the map bounds in ViewPortStorte#reduce. This means we first fit the map to the info bounds and shortly after fit it to the route bounds (or vice versa). Apparently the /info request is always (?) faster so we first fit the map to the info bounds and eventually zoom to the route bounds as it should be. However, this is rather coincidental. Using OpenLayers (#159) I also ran into the opposite case where we first fit the map to the route bounds, but then end up with the map being zoomed out entirely (fit to the info bounds). Not sure why this never seems to happen in current master, but I was able to reproduce this by adding a small delay for the InfoReceived event.

This could even be related to longer map loading times, because first we 'zoom out' (triggering map tile requests) only to 'zoom in' again just after that.

Btw we had the same issue in #82, but I think this was only partly fixed/hidden so far.

Activity

  1. added
    bug
    on Nov 16, 2021
  2. added this to the 0.3 milestone on Nov 16, 2021
  3. easbar commented on Nov 16, 2021

    @easbar
    MemberAuthor

    I think the two requests are triggered here:

    getApi().infoWithDispatch() // get infos about the api as soon as possible
    // hook up the navbar to the query store and vice versa
    const navBar = new NavBar(getQueryStore(), getMapOptionsStore())
    // parse the initial url
    navBar.parseUrlAndReplaceQuery()

    Can we somehow first parse the url so in case some points are given (and a route request will be fired) we can prevent the update of the map bbox that is based on the /info response?

  4. easbar commented on Jan 20, 2022

    @easbar
    MemberAuthor

    For now we disabled zooming to the info bbox entirely as it is always the entire planet except for local setups, so I'll close here. We can consider zooming to the info box in #117 again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions