On Nov 9, 1:07 pm, streetview99 <[EMAIL PROTECTED]> wrote:
> OK Thanks you all. I got the POV angle right when I hardcoded this
> page
>>http://www.easysavannahlive.com/listing1.html
> by trial & error. But these listings are tied to street addresses in MySql in 
> a
> phpmydirectory.com business directory. We were so close.

You can calculate the yaw for the POV automatically if you have the
camera location and the building location.  There are issues however:
1. if Google doesn't have "rooftop" geocoding in that area the
geocoded address will be on the street not where the building is (so
it won't be useful for calculating yaw).  If the correct location is
stored in a database and not retrieved by geocoding the address, this
shouldn't be an issue.
2. if the "rooftop" geocode is too far from the street,
getNearestPanorama will not find a camera location for you.
This page shows the result returned by the geocoder and a set of
streetview camera locations around it:
http://www.geocodezip.com/example_geo2_panoJ.asp?addr1=591%20Camino%20De%20La%20Reina,%20San%20Diego,%20CA&geocode=1
The result returned by the geocoder doesn't result in a valid location
for a camera from getNearestPanoramaLatLng, but there are camera
locations available that show the building.
Note: in some browsers, the first click on the streetview camera
locations doesn't work, it displays a blank infoWindow, subsequent
clicks work.

You could store both the building location and the streetview camera
location in your data base, but I'm not sure what will happen if the
streetview locations are updated.

  -- Larry






> My perrson
> who has arranged the coding for this has switched to this code here 
> >http://www.tulsaview.com/Johny-Carinos.html. It angles better than
> the first w/ the default north I think, obviously,  but now it kicks
> the infowindow/bubble out that had contact info & driving directions.
> Below is the relative code snip:
>
>  <script type="text/javascript" src="http://maps.google.com/maps?
> file=api&amp;&v=2.x&key=ABQIAAAAJ2uU0fyJzu5tZPu7ABycOBQXwcuN3Stw9SMgl9vDTGo 
> gEtk2MBTTDl4sVaPGoO5OeJJvyQdP9sHuHg
> "></script>
>     <script type="text/javascript">
>     var map;
>     var myPano;
>     var panoClient;
>     var houseMarker;
>
>     function initialize() {
>       panoClient = new GStreetviewClient();
>       map = new GMap2(document.getElementById("map_canvas"));
>       map.setCenter(new GLatLng(36.021802,-95.949298), 15);
>       map.addControl(new GSmallMapControl());
>       map.addControl(new GMapTypeControl());
>
>       houseMarker = new GMarker(new
> GLatLng(36.021802,-95.949298       ));
>       map.addOverlay(houseMarker);
>
>       GEvent.addListener(houseMarker, "dragend", function() {
>         panoClient.getNearestPanorama(houseMarker.getLatLng(),
> showPanoData);
>       });
>
>       myPano = new
> GStreetviewPanorama(document.getElementById("pano"));
>       panoClient.getNearestPanorama(houseMarker.getLatLng(),
> showPanoData);
>     }
>
>     function showPanoData(panoData) {
>       if (panoData.code != 200) {
>         GLog.write("showPanoData: Server rejected with code: " +
> panoData.code);
>         return;
>       }
>       var angle = computeAngle(houseMarker.getLatLng(),
> panoData.location.latlng);
>       myPano.setLocationAndPOV(panoData.location.latlng, {yaw:
> angle});
>     }
>
>     function computeAngle(endLatLng, startLatLng) {
>       var DEGREE_PER_RADIAN = 57.2957795;
>       var RADIAN_PER_DEGREE = 0.017453;
>
>       var dlat = endLatLng.lat() - startLatLng.lat();
>       var dlng = endLatLng.lng() - startLatLng.lng();
>       // We multiply dlng with cos(endLat), since the two points are
> very closeby,
>       // so we assume their cos values are approximately equal.
>       var yaw = Math.atan2(dlng * Math.cos(endLatLng.lat() *
> RADIAN_PER_DEGREE), dlat)
>              * DEGREE_PER_RADIAN;
>       return wrapAngle(yaw);
>    }
>
>    function wrapAngle(angle) {
>     if (angle >= 360) {
>       angle -= 360;
>     } else if (angle < 0) {
>      angle += 360;
>     }
>     return angle;
>   };
>
>     </script>
>
>   <body onload="initialize()" onunload="GUnload()">
>     <div id="map_canvas" style="width: 366px; height: 300px"></div>
>     <div name="pano" id="pano" style="width: 366px; height: 250px"></
> div>
>   </body>
>
> Ideas? Both the sites shown are in development. I'd visited back
> earlier but I didn't think my posts were going to post. I don't have
> any other code from the php as I don't have it installed yet. I just
> helped pay for it. My guy is trying to figure it out. Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to