Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to know street direction (compass)?

I'm working on a project where we need to know the direction (compass) of a street. Actually, we only have a GeoPoint (lat;long and heading) we are planning on using reverseGeocoding to tell where is it (which street?); and then we 'd like to know if he's heading in the wrong way.

Google Maps, OSM, Mapquest they all display an arrow over the street which indicates its direction. I guess they draw them dinamically, so they have to know their angle. That's what I'd like to know (if possible)

Thanks in advance!

#

EDIT:

I'm thinking maybe they cut the street into little pieces and then they said "this track of the street goes from (lat1;lng1) to (lat2;lng2)" that would give that track a direction, an so they can draw that arrow. Also not every street is a straight line, so its direction is not only one, it depends on which portion of the street you are in.

like image 576
sebasira Avatar asked Mar 03 '15 23:03

sebasira


People also ask

How can you tell which direction a house is facing?

Press Ctrl and use your mouse or touchpad to rotate the map. Turn the map to roughly face the direction of the property you want to measure. If the red needle is now still on top, the property is north-facing, if the white needle is now on stop, the property is south facing.

Can you see compass direction on Google Maps?

In the Google Maps app, you should see a small compass symbol visible in the top-right corner, below the button for changing the map terrain and style. If the compass isn't currently visible, use two of your fingers to move the map view around to display it.

What is street direction?

Street direction means any of the eight basic compass directions, abbreviated as follows: N,S, E, W, NE, NW, SE, or SW. If a pre-street direction is used, it is the first element of the street name. If a post-street direction is used, it is the last element of the street name.

How do we show direction on a compass?

A compass is a tool used to show directions. It has a needle that spins and always points north. You can turn the compass so that the needle points to north on the dial. If you know you should be heading southwest, then you can head in the right direction.


1 Answers

With OpenStreetMap it is possible to determine whether the street at the current position is a oneway street and whether the user is driving into the wrong direction.

The Overpass API allows to download objects inside a given bounding box (your current location). For downloading streets you have to specify the highway tag, oneway streets are marked by the oneway tag. Ideally you should read a little bit about OSM's basic elements and tags to get an idea about how OSM's internal work. Then start to play around with overpass turbo which is a nice web frontend for Overpass API.

See this example query on overpass turbo:

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

It retrieves all ways with a highway tag in the given bounding box.

Note that the result might contain multiple highways if they are contained in the given bounding box, or none of the bounding box is too small.

like image 180
scai Avatar answered Nov 15 '22 12:11

scai