NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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's gravatar image

ThomasSo13
11112
accept rate: 0%

edited 10 Nov '20, 15:11


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.

permanent link

answered 10 Nov '20, 19:47

Spiekerooger's gravatar image

Spiekerooger
3.1k22356
accept rate: 16%

alt text

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.

permanent link

answered 10 Nov '20, 18:06

andy%20mackey's gravatar image

andy mackey
13.2k87143285
accept rate: 4%

edited 10 Nov '20, 18:09

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×111
×63
×60
×14

question asked: 10 Nov '20, 15:11

question was seen: 2,057 times

last updated: 10 Nov '20, 19:47

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum