Uncaught TypeError: Cannot read property 'currentStyle' of null - Street View code

1,300 views
Skip to first unread message

ammu

unread,
Sep 27, 2011, 4:34:11 PM9/27/11
to Google Maps JavaScript API v3
Hi All,

I am trying to implement street view of a point.
I am calling this from onclick of a link. If street view is not there
for a point then it displays the alert but if available nothing
happens and in error console I see this error:

Uncaught TypeError: Cannot read property 'currentStyle' of null

function streetview(lat1,lng1)
{
var sv = new google.maps.StreetViewService();
var e=new google.maps.LatLng(lat1,lng1);
console.log('loc2'+e);
sv.getPanoramaByLocation(e, 50, processSVData);
var statusLoc;
function processSVData(data, status) {
statusLoc=status;
console.log('status'+statusLoc);
if(statusLoc=='OK')
{
console.log('loc1'+lat1);
console.log('loc2'+lng1);

var panoramaOptions = {
position:e,
pov: {
heading: 165,
pitch:0,
zoom:1
},
enableCloseButton: true
};
var myPano = new
google.maps.StreetViewPanorama(document.getElementById("map_canvas"),
panoramaOptions);
myPano.setVisible(true);

}
else
{
alert("Street View data not found for this location.");
}}}

can someone pls help?

xelawho

unread,
Sep 27, 2011, 4:54:51 PM9/27/11
to Google Maps JavaScript API v3
> can someone pls help?

how? there's nothing in that snippet that even refers to currentStyle.
Are we supposed to guess what that is?

if only there were some way of seeing your map in operation...
Reply all
Reply to author
Forward
0 new messages