Is it possible to find out the direction of the street (compass)?

I am working on a project where we need to know the direction (compass) of the street. In fact, we only have GeoPoint (lat; long and header), we plan to use reverseGeocoding to indicate where it is (which street?); and then we would like to know if he is heading the wrong way.

Google Maps, OSM, Mapquest all of them display an arrow above the street, which indicates its direction. I think they draw them dynamically, so they need to know their angle. This is what I would like to know (if possible)

Thanks in advance!

#

EDIT:

I think maybe they cut the street into small pieces, and then said: “This street track goes from (lat1; lng1) to (lat2; lng2),” which will give this track direction so that they can draw this arrow. Also, not every street is a straight line, so its direction is not only one, it depends on what part of the street you are on.

+4
source share
4 answers

Using OpenStreetMap, you can determine if the street in its current position is a street street and whether the user is moving in the wrong direction.

API Overpass ( ). , oneway. OSM basic elements tags, , OSM. overpass turbo, API Overpass.

. :

[out:json][timeout:25];
// gather results
(
  way["highway"](51.04525236350533,13.778518438339233,51.04603818288315,13.779301643371582);
);
// print results
out body;
>;
out skel qt;

.

, , , .

+6

, , , , ( ?)

, , GraphHopper, ;) , .

, , , 1 2 .

, , . 2 , , . . (7 ) (145m). .

BTW: GPS- ( ), .

+2

2 . .

2 , google.maps.geometry.spherical.computeHeading(point1, point2)

: https://developers.google.com/maps/documentation/javascript/examples/geometry-headings

Btw, getHeading() , , . AFAIK, , , 4 90 , . , setHeading().

0

getHeading() . ( ) .

-1

All Articles