I don't set the street view position at creation because I later feed in the
center position before displaying the street view. I show an overlay of the
street view like we used to have in version 2 of the api and when the user
clicks on an overlay position I set the center.
What I have now is the following in case anyone else has similar problems as
to what I was having:
myPano = new
google.maps.StreetViewPanorama(document.getElementById("pano"));
map.setStreetView(myPano);
myPano.setVisible(true);
InitMarkersForSV();
OverlayListeners.push(google.maps.event.addListener(map,"click", function
(/*overlay,*/point/*,overlaylatlng*/) {
latlng = point.latLng;
if(latlng)
SetPano(latlng);
else if(overlaylatlng) {
try {
SetPano(overlaylatlng);
}
catch(error) {
alert("There doesn't appear to be a Street View for that
location!");
}
}
else
return;
}));
I ended up getting ready of the specific properties returned from the old
version of the map click event and have limited myself to just retrieving
the point they click on the map. I am hoping that we eventually have the
ability to add a regular street view overlay like we did in version 2 of the
api. I still have yet to figure out how to add the street view overlay like
you get when you begin to drag the pegman icon without actually having the
pegman icon control on the map and it being dragged.
Thanks,
Nathan
On Fri, Jun 11, 2010 at 5:37 PM, Marc Ridey <[email protected]> wrote:
> I don't see where you are setting the map center. I'm guessing tempPosition
> is null when it's passed to StreetViewPanorama.
> Can you explain what behavior you are trying to achieve.
>
> Thanks
>
> On Sat, Jun 12, 2010 at 12:37 AM, Nathan Raley <[email protected]>wrote:
>
>> I am trying to add a street view in my program as I am migrating from v2
>> to v3.
>>
>> I have the following set up in my initialize function that runs after the
>> page is loaded:
>>
>> map = new google.maps.Map(document.getElementById("map"), mapOptions);
>> //{ googleBarOptions : { style : "new"} });
>> DistanceTextBox = (document.getElementById("distancetext"));
>> var tempPosition = map.getCenter();
>> var PanoOpts = {
>> position: tempPosition,
>> navigationControl: true,
>> addressControl: false,
>> zoom: 14
>> };
>> myPano = new
>> google.maps.StreetviewPanorama(document.getElementById("pano"), PanoOpts);
>> map.setStreetView(myPano);
>>
>> I keep getting an object expected on the line where I create the new
>> StreetviewPanorama.
>>
>> Any ideas?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Maps JavaScript API v3" group.
>> To post to this group, send email to
>> [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-maps-js-api-v3%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps JavaScript API v3" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-maps-js-api-v3%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.