Feature of This MashUp will be
- To Take input as source and destination address.
- Animate the street view & Bird’s Eye from source to destination.
Bird’sEye View requires only one extra parameter "orientation" which can be
- North
- East
- South or
- West

Since we will concentrate on driving , we will keep the pitch horizontal i.e. pitch will be zero.
Yaw can be calculated by using 2 points along the path. Yaw is the angle of your driving direction from North, in degrees.
Here is a JavaScript code to calculate Yaw with given 2 values of GLatLng.
(Note that Yaw & Bearing is closely related terms and they are having same value here.)
One feedback about street-view API though, function setLocationAndPOV is very mysterious and I could not make it work.function GetBearing(GLatLng1, GLatLng2) { var lat1 = GLatLng1.lat(); var lon1 = GLatLng1.lng(); var lat2 = GLatLng2.lat(); var lon2 = GLatLng2.lng(); lat1 = lat1.toRad(); lat2 = lat2.toRad(); var dLon = (lon2 - lon1).toRad(); var y = Math.sin(dLon) * Math.cos(lat2); var x = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon); return Math.atan2(y, x).toBrng(); }
Individual Code snippets I picked from here
Now Jump To Demo
And Do ViewSource to see the code.
No comments:
Post a Comment
Your comment will inspire me, Please leave your comment