Good day.

Tell me, please, how to make a calculation on the map not along the roads, but simply in a straight line, since along the roads it does not consider the cost across the entire map, that is, it considers only those who have a route by car. The calculation itself has already been done, you just need to redo it on a straight line, by plane, for example. Here is a link to the service http://abtt.ru/test/test1/raschet_stoimosti1.php
I would be very grateful for the help.

  • @ Shanty4145, If you are given an exhaustive answer, mark it as correct (click on the check mark next to the selected answer). - Vitalina

1 answer 1

If you understand correctly, are you interested in calculating the distance between two coordinates?

Here is an example of a function in PHP:

http://www.geodatasource.com/developers/php

Based on the principle used there, you can already rewrite to another desired language.

Update

Again, if you understand correctly, you are interested in how to draw a simple line between two coordinates. This article has an example http://habrahabr.ru/post/197448/

new google.maps.Polyline({ path: [new google.maps.LatLng(16.003575733881323, 101.689453125), new google.maps.LatLng(59.934288, 30.3350336)], //указываем точки старта и финиша geodesic: true, //устанавливаем флаг геодезической кривой. Так и выглядит лучше и точнее передает кратчайший путь между двумя точками map: map //устанавливаем на карту }); 
  • The cost calculation is already available, the distance is not required, now there is a route along the roads, but, unfortunately, for example, from Russia to America there is no route for a car, so, in fact, it does not consider, and does not plot a route, and if done, for example just a line, as mtrgroup.ru is here, there will be a calculation across the entire map, but I still can’t figure out how to do it because I don’t quite understand. - Shanty4145