Giter Site home page Giter Site logo

Change units to miles about lrm-mapzen HOT 5 CLOSED

nextzen avatar nextzen commented on August 27, 2024
Change units to miles

from lrm-mapzen.

Comments (5)

hanbyul-here avatar hanbyul-here commented on August 27, 2024

Now it is available via throwing parameter to Formatter like,
formatter: new L.Routing.Valhalla.Formatter({units:'imperial'})

  • corrected wrong answer

from lrm-mapzen.

matbeard avatar matbeard commented on August 27, 2024

Hi, I've tried without the unitNames parameter, as you suggested on the leaflet-routing-machine repo, but it doesn't seem to have any effect.

Am I right in thinking the json passed to Valhalla should include a units parameter with this setting? It isn't doing... this is an example of the json that's generated:
{"locations":[{"lat":53.43753,"lon":-1.10557,"type":"break"},{"lat":53.5224,"lon":-1.1394,"type":"break"}],"costing":"auto"}

Any suggestions? Or am I missing something?

Thanks

from lrm-mapzen.

dgearhart avatar dgearhart commented on August 27, 2024

If you want miles returned from Valhalla then you need to add directions_options":{"units":"miles"} to the request, for example:
{"locations":[{"lat":53.43753,"lon":-1.10557,"type":"break"},{"lat":53.5224,"lon":-1.1394,"type":"break"}],"costing":"auto","directions_options":{"units":"miles"}}

from lrm-mapzen.

kevinkreiser avatar kevinkreiser commented on August 27, 2024

If you are using the upstream, couldn't it be the case that the commits that added this feature aren't merged upstream? @hanbyul-here did you pr your changes back to upstream?

from lrm-mapzen.

hanbyul-here avatar hanbyul-here commented on August 27, 2024

Yes, you can pass the unit option to Valhalla, but lrm-valhalla is currently not using that option. It just gets default value from Valhalla in km, and converts it with Formatter (It is planning to update to use all available options of Valhalla soon! ) I updated example of lrm-valhalla using miles on master branch, and npm side too. Please try this and let us know it works for you or not.

from lrm-mapzen.

Related Issues (20)

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.