markers on streetview after pegman drop

92 views
Skip to first unread message

dbrb2

unread,
Oct 1, 2011, 1:40:46 PM10/1/11
to google-map...@googlegroups.com
I have a google v3 map with streetview pegman control.

The map also contains a marker, which is periodically moved.

I wanted to be able to see this marker when I was in streetview mode, so I created a panorama:
I created a panorama:

var panoramaOptions = {
          addressControl: false,
          enableCloseButton: true,
           pov: {
            heading: 90,
            pitch: 0,
            zoom: 0
          }
    };


panorama = new  google.maps.StreetViewPanorama(document.getElementById("map_canvas"),panoramaOptions);

(note the panorama is in the map_canvas div - the same div used for the map)

I hope then that, if I enabled the panorama (by dragging the pegman onto the map), if I panned to the correct location I would see any markers that I had placed on that map using the:

marker2.setPosition(latlng);

where latlng is a position, and marker2 was created with:

marker2 = new google.maps.Marker({
                  position: latlng,
                  cursor: "http://maps.google.com/mapfiles/openhand.cur",
                  icon: "marker.png",
                  map: panorama
                  });


But instead, though streetview loads, I see no markers.

Am I doing something obviously wrong?

Cheers,

Ben




Marc Ridey

unread,
Oct 2, 2011, 12:53:04 AM10/2/11
to google-map...@googlegroups.com
The map already has a panorama by default. If you create your own panorama to replace it, you need to link the map and the panorama using map.setStreetview(panorama).
Without a test link, it's hard to guess but I would think that's the issue.

Marc





--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/cwyuPrdWaBwJ.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply all
Reply to author
Forward
0 new messages