Hi! Our customers can use a configurator to plan their individual furniture. Part of this configurator should also be an estimated price with included delivery costs. Therefore the customer should only enter his adress and postal code in a website-form. With the distance from this adress and our location (kilometer) we could calculate these delivery costs on the website (using java-script). How do I get this distance by using adress and postal code? How can I realize this calculation with openstreepmap using a html-Website and java-script? Is there a script I can use? I hope, you can help me, Thomas asked 10 Nov '20, 15:11 ThomasSo13 |
As I assume you are looking for a turn-by-turn distance to calculate freight costs, you should go for a routing API based on OSM data. Examples for your use case are OSRM, Graphhopper or Valhalla. Easiest way would be to use one of the hosted APIs, e.g. by Graphhopper, that offer API documentation or example integrations as well (see e.g. https://docs.graphhopper.com/#tag/Routing-API ). If you rather want to try out OSRM, there is a hosted version by several providers, e.g. Geofabrik or https://routing.openstreetmap.de/about.html (provided by FOSSGIS e.V. - only for light use). Valhalla is offered as a hosted API by Geoapify, as far as I know. answered 10 Nov '20, 19:47 Spiekerooger |
Click on the route arrow and put in start and end points. A route will be calculated ( also for walking and cycling options for other uses). You may find it is not quick or easy enough for your use. You may find it simpler to build a quick look up table with a few limited areas of delivery prices. You may find postcodes are not complete enough either, although there are some busy postcode mappers working hard on post code coverage. answered 10 Nov '20, 18:06 andy mackey |