Skip to content

Feature Request: center-on-location search box #249

Closed

Description

@jeffrey-friedl

I'd find it convenient to be able to center the map view to a specific latitude/longitude, as in the simple search box seen on common mapping services. In particular, when working with a route that has dozens of points covering hundreds of kilometers, it's difficult to home in on a specific place (e.g. a customer location) to see how the map routes nearby.

Activity

  1. jeffrey-friedl commented on Aug 5, 2018

    @jeffrey-friedl
    Author

    No, not at all. I mean a separate input box that centers the map at the given location, without having any influence on the route.

    For example given this page:

    https://graphhopper.com/maps/?point=36.764957%2C137.229066&point=36.711814%2C137.222371&point=36.700683%2C137.220182&point=36.698756%2C137.219045&point=36.699935%2C137.213101&point=36.69082%2C137.212608&point=36.688153%2C137.212329&point=36.685559%2C137.212071&point=36.650689%2C137.209754&point=36.639946%2C137.209411&point=36.616595%2C137.205377&point=36.599819%2C137.203445&point=36.583899%2C137.206149&point=36.575353%2C137.207994&point=36.47366%2C137.237349&point=36.470933%2C137.239913&point=36.340416%2C137.295048&point=36.321514%2C137.31053&point=36.29223%2C137.372918&point=36.240327%2C137.526298&point=36.223434%2C137.535739&point=36.192729%2C137.547895&point=36.124322%2C137.558527&point=36.180703%2C137.51088&point=36.17502%2C137.506042&point=36.195156%2C137.256918&point=36.208269%2C137.216063&point=36.217376%2C137.196536&point=36.241539%2C137.171774&point=36.252476%2C137.148857&point=36.467681%2C137.084656&point=36.572349%2C137.125533&point=36.760393%2C137.194262&locale=en-US&vehicle=racingbike&weighting=fastest&elevation=true&use_miles=false&layer=Omniscale

    I'd like to center the page on 36.1694835,137.3062015 to see how close the route is to a convenience store at that location. That's currently very difficult without using another mapping service and swapping back and forth to try to zero in on the location.

  2. karussell commented on Aug 6, 2018

    @karussell
    Member

    Sorry, I don't understand this request. Can you give me an example of your use case?

    Do you want a separate input box for some additional marker and the map should then center around it? We would definitely not add something like this.

    Instead showing a layer with hotels or restaurants on the map might be a useful addition (#284)

  3. jeffrey-friedl commented on Aug 6, 2018

    @jeffrey-friedl
    Author

    My request is really as simple as I first asked. It involves no markers on the map, no layers, no changes to the route. It's really just a "pan the current display such that this location is what's visible in the center of the screen". A "pan to this location" input box separate and unrelated from anything to do with the route.

    As a use case, imagine you have a complex route with dozens of points covering a distance of hundreds of kilometers, say, "a tour through Italy", and you hear about the location of some attraction you'd perhaps like to visit along the way if you're close, but you don't know whether your route goes anywhere near. If you zoom the map in on the location of that attraction, you'll see whether the route goes close, and perhaps decide to skip it, or perhaps decide to modify the route so that it goes to the attraction. In any case, there's currently no way to "zoom the map in on the location" unless you already know exactly where it is.

    So, my request is a small "pan to: ______" input box off in some out-of-the-way corner, that accepts a lat/lon pair, and centers the map display at that location, and perhaps zooms the display to something reasonably close. That's all.

    Thanks.

  4. karussell commented on Aug 6, 2018

    @karussell
    Member

    A "pan to this location" input box separate and unrelated from anything to do with the route.

    We can surely parse some kind of 'center' and 'zoom' parameter from the URL but a separate input box won't happen.

  5. jeffrey-friedl commented on Aug 6, 2018

    @jeffrey-friedl
    Author

    "We can surely parse some kind of 'center' and 'zoom' parameter from the URL" -- I'd appreciate that

  6. karussell commented on Aug 6, 2018

    @karussell
    Member

    BTW: you can easily contribute to this project and my answer was just about the scope of our UI not that we implement it soonish or something (just to clearify and avoid disappointment)

  7. jeffrey-friedl commented on Aug 6, 2018

    @jeffrey-friedl
    Author

    I understand, thanks for the clarification. I take a look.

  8. jeffrey-friedl commented on Feb 27, 2020

    @jeffrey-friedl
    Author

    One thought on the UI for this.... it could be an additional "pan map to..." item in the context menu, which then brings up an input box that accepts a lat/lon pair.....

  9. jeffrey-friedl commented on Jan 17, 2022

    @jeffrey-friedl
    Author

    I finally dug into the code, and implemented the "Move to coordinates" right-click context menu. I wish I hadn't waited four years.... it's been extremely useful when building/checking cycling routes. 😍

    The callback is super simple:

        callback: function (e) {
            var coords_text = prompt("Move to point...", "latitude,longitude");
            var coords = coords_text.match(/(-?\d+\.\d+)[^-\d]+(-?\d+\.\d+)/);
            if (coords)
                map.setView(new L.LatLng(coords[1], coords[2]), 17);
        },
    

    @karussell , you mentioned that you'd not be adding something like this to the UI, but perhaps the right-click context menu would be okay?

  10. karussell commented on Jan 17, 2022

    @karussell
    Member

    Thanks for posting the snippet :) !

    I'm unsure if we should create something separate. Why not add this location to the route to see its position via the red marker then?

  11. easbar commented on Jan 17, 2022

    @easbar
    Member

    For our new maps client we were thinking about including the camera position in the URL so you could also adjust it this way. This has the advantage that one can share a location or a part of a route etc. using an URL.

  12. jeffrey-friedl commented on Jan 17, 2022

    @jeffrey-friedl
    Author

    Thanks @karussell. It's not that I want to see the position on earth of a target location; I want to inspect the current route in the vicinity of the target location, perhaps then to make specific changes, which may be moving a marker, deleting a marker, or adding markers.

    A common use case: I'm inspecting the GraphHopper generated route in Google Earth, and I see an area where a slightly-different road would be better. I want to quickly zoom into that area on my GraphHopper map, and make adjustments as needed to get the desired routing. Again, this might involve deleting or moving an existing marker.

    A common use case: in Earth I see the route pop off onto a side road for 10m and return to the main road. That's certainly because I was sloppy when placing a marker, so I want to jump to that section of the GraphHopper map to make an adjustment on the marker.

    Adding the location blindly to the route means having to know which point it should be added as, which already makes it impossible, but if my goal had been to remove a marker, the moment I remove the added-so-that-I-could-find-the-location-on-the-map marker, the zoom changes to view the whole route and I've lost the close-up view of where I wanted to work in the first place. (The auto-zoom-out upon marker deletion is also something I personally find counter productive.)

  13. jeffrey-friedl commented on Jan 17, 2022

    @jeffrey-friedl
    Author

    BTW, would it be possible to get the profile-related sections of the config YML as used by https://graphhopper.com/maps ? I tried to replicate racingbike locally, but the routes I get are different from the ones at https://graphhopper.com/maps .

    Also, if I may, is the routeManipulation.js in github the one actually being used at https://graphhopper.com/maps ? When I try to add an intermediate point, it often gets inserted into the wrong index. Somehow module.exports.getIntermediatePointIndex is computing a different index for me locally than the web site does, for the same route.

  14. karussell commented on Jan 17, 2022

    @karussell
    Member

    Ok, make sense, but this is a very specific use case and I'm unsure we should support this.

    And also @easbar is right that you could, maybe in a later version of maps 2.0, modify the URL to achieve this. See the discussion about it in the other repository: #168 (comment)

    I tried to replicate racingbike locally, but the routes I get are different from the ones at https://graphhopper.com/maps .

    For different topics / questions it would be better when you create a new topic in our forum. ( we do not use any special config for racingbike, except maybe that we use cgiar elevation data )

  15. jeffrey-friedl commented on Jan 17, 2022

    @jeffrey-friedl
    Author

    My examples were specific to my needs, but the it's a general mapping desire to be able to look at a specific section of a map. Oh, and "pretty please". 😀 I do understand the desire to avoid feature bloat; this small thing tucked away in a context menu seems pretty innocuous.....

  16. karussell commented on Jan 17, 2022

    @karussell
    Member

    it's a general mapping desire

    You were the only one in the last 4 years that requested this 😄

    Btw: if you know the address you can already move the map to that location without adding it to your location via entering the address in the input and then selecting the suggestion one by one via up and down keys.

  17. easbar commented on Jan 17, 2022

    @easbar
    Member

    Ok, make sense, but this is a very specific use case and I'm unsure we should support this.

    I think I can see how it is useful.

    this small thing tucked away in a context menu seems pretty innocuous.....

    We could also assign some random keyboard shortcut, and maybe it is possible using the dev console? Otherwise it is probably similar in terms of feature bloat and usefulness as the 'Show coordinates' context menu except the latter makes more sense to be in the context menu, because it is specific to the clicked location.

  18. jeffrey-friedl commented on Jan 17, 2022

    @jeffrey-friedl
    Author

    I use "show coordinates" all the time (though in my local install I changed it to "Copy coordinates to clipboard" 😁).'

    You were the only once in the last 4 years that requested this 😄

    I meant that it's a general desire for any mapping app. All the major mapping apps (Google, Apple, Garmin, etc.) allow you to enter a location to simply move the map there, even if they otherwise allow you to edit/construct things on the map.

    Btw: if you know the address you can already move the map to that location

    Unfortunately, this doesn't work for a latitude/longitude pair. And in a test I just did with an address, as I used the up/down arrows it did add the location to the route with each up/down keypress....until I'd hit the up/down arrows too quickly and got my IP blocked. 😢

  19. easbar commented on Jan 17, 2022

    @easbar
    Member

    I use "show coordinates" all the time (though in my local install I changed it to "Copy coordinates to clipboard" grin).'

    That would be very useful indeed. But we should really focus on finishing the new map client (github.com/graphhopper/graphhopper-maps)

    I meant that it's a general desire for any mapping app. All the major mapping apps (Google, Apple, Garmin, etc.) allow you to enter a location to simply move the map there, even if they otherwise allow you to edit/construct things on the map.

    How do you do it in Google Maps? Say you calculated a route, how do you enter another coordinate to adjust the camera position?

  20. karussell commented on Nov 7, 2023

    @karussell
    Member

    @jeffrey-friedl Is there something more required in the new GH Maps? You can right click the map to get the coordinates.

  21. jeffrey-friedl commented on Nov 8, 2023

    @jeffrey-friedl
    Author

    @jeffrey-friedl Is there something more required in the new GH Maps? You can right click the map to get the coordinates.

    This was not a request to display the coordinates of a location, but to have a way to get a specific location to appear on the screen without making any changes to the route... a "zoom in on XXXX" feature. This was all discussed in this thread last year. I ended up implementing it in a local version (along with an "extend track to..." feature, and a bunch of other changes that make it a much-more useful tool for me), so I no longer use the one at GraphHopper.com

  22. karussell commented on Nov 8, 2023

    @karussell
    Member

    Sorry for not closely reading the thread and thanks for the explanation! Will close here until some interests from others too.

    "extend track to..." feature

    Can you describe how it looks? Is it a new entry in the context menu that basically replaces clicking on "Add Location" and then right click on the map and "To here"?

  23. jeffrey-friedl commented on Nov 9, 2023

    @jeffrey-friedl
    Author

    Can you describe how it looks? Is it a new entry in the context menu that basically replaces clicking on "Add Location" and then right click on the map and "To here"?

    Yes, exactly.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions