Google Maps for beginners
Although this story is related to Google Maps API the concepts remain the same throughout. I’ve used python for this but the concepts remain language-agnostic mostly.
If you scroll through Google directions api
You’ll find this API:-
https://maps.googleapis.com/maps/api/directions/json?
origin=Toronto&destination=Montreal
&key=YOUR_API_KEY
PS: API — Key is needed.
It gives a long data.
- Here one interesting data is POLYLINES.
A polyline is a list of points, where line segments are drawn between consecutive points.
Polyline is having all the LAT/LNG points in between two major co ordinates.
If you want to know more refer this:
2. Then comes the concept of bearing
Bearing (orientation) The bearing is the direction in which a vertical line on the map points, measured in degrees clockwise from north.
3. Distance calculation.
We cant calculate the distance using simple geometry because of the sherical nature of Earth.
The Haversine (or great circle) distance is the angular distance between two points on the surface of a sphere. The first coordinate of each point is assumed to be the latitude, the second is the longitude, given in radians.
These are important concepts to learn for using the maps.
source code can found here: