1

Let's suppose there are two places coordinates (street places).

I know that straight direction between them I can calculate by formula.

Also we know that route between those coordinates can be different, depends roads where human or car can drive through.

Is distance between two coordinates on the map(street view) always minimal distance comparing others paths? I think now, because straight the path can be uphill and from the mountain. This is not consider by formula haversine.

I need calculate distance between two coordinates, where courier is now and where he should go.

Could I avoid paid Google Service to calculate distance between two coordinates in my business application? Or it is unreal?

What do famous applictions use for that?

Could I say that distance would be shortest between two coordinates using this formula in short distance (less 1000km)?

enter image description here

This formula uses radians and returns central angle in radians.

Then final formual is:

enter image description here

Is it enough to calculate shortest distance between two coordinates (less 1000 km between)?

2

You can use an open source solution like GraphHopper. You can test the commercial demo here: https://graphhopper.com/maps/ but there is also a community version, which you can run on your own.

GraphHopper works on the basis of Open Street Map data, so if your area of operations is poorly mapped than it would not be a best way to go. However, you may always encourage your clients to contribute :)

Anyway, for version 0.10 of GraphHopper you may follow the following steps to run your own instance of routing service:

Beware, the first run of the routing service might take a while, as GraphHopper is rebuilding PBF into a... graph of the streets :) Which is then used by a version of A* algorithm to search for a shortest route.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.