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

I intend to make my own OSM Router, and I do not want to use third party OSM routers.

WHAT I HAVE DONE: I have downloaded OSM data in XML format and applied different algorithms to find the shortest path between two nodes in map using their coordinates (longitude/latitude). Everything is working fine.

THE PROBLEM: The only problem is OSM XML data has only limited number of coordinates (longitude/latitude). I want to find the distance between two coordinates (longitudes/latitudes) which are not found as nodes in OSM. I could not find any thing related to this on internet.

FOR INSTANCE, I have a random longitude/latitude for point A, and random I have a random longitude/latitude for point B. These longitudes and latitudes are not available in OSM XML data. How can I find the distance between these two points?

asked 19 Sep '19, 17:27

hk_hamzakhalid's gravatar image

hk_hamzakhalid
11112
accept rate: 0%


Use your favourite search engine to search for the words "Haversine Formula", or you might also find libraries that already implement this.

permanent link

answered 19 Sep '19, 19:03

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

I have the feeling hk was rather looking for a way to find the closest node in the routing graph and base the distance calculation on the OSM network he has already used for routing.

(20 Sep '19, 08:18) TZorn

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:

×305
×133
×55
×45
×44

question asked: 19 Sep '19, 17:27

question was seen: 3,711 times

last updated: 20 Sep '19, 08:18

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