[Google Maps API v3] remove marker from google maps

652 views
Skip to first unread message

alef

unread,
May 25, 2010, 10:21:02 AM5/25/10
to Google Maps JavaScript API v3
hi,
is possibile remove all markers from the map when the street view
panorama is open?

thanks

--
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 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.

Marc Ridey

unread,
May 25, 2010, 9:28:26 PM5/25/10
to google-map...@googlegroups.com
StreetVIew and Map share their markers.
To avoid having the two view share markers, create a panorama and assign it to the map.
Such as:

var panorama = new google.maps.StreetViewPanorama(map.getDiv());
map
.setStreetView(panorama);

gardnose

unread,
Jun 8, 2010, 9:07:51 AM6/8/10
to Google Maps JavaScript API v3
How would this work with the standard map option for
'streetViewControl:true'?

I'd prefer to avoid creating my own maptypecontrol and pegman
functionality just to hide the markers for a streetview.

Failing that - are there any events associated with the standard
streetViewControl that I can use?

Thanks,
Gavin

Marc Ridey

unread,
Jun 8, 2010, 5:57:35 PM6/8/10
to google-map...@googlegroups.com
It doesn't affect the pegman support. Add streetViewControl:true in the map options to turn on the pegman.

gardnose

unread,
Jun 9, 2010, 3:54:50 AM6/9/10
to Google Maps JavaScript API v3
Thanks Marc,

Think I'm still missing something here. What I want is to use
'streetViewControl:true' to enable the pegman control.
Then when I drop the pegman onto the map, I'd like to hide the
markers.

You can see what I'm trying to do here:
http://www.abergavenny.org.uk/accommodation.htm

I've just had a look through this thread but can't find what I'm
looking for:
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/d87b18de3a096b8d

Is there an event for "pegman dropped" which I can use to hide the
markers?

Thanks,
Gavin
> > google-maps-js-a...@googlegroups.com<google-maps-js-api-v3%2Bunsu...@googlegroups.com>
> > .

Marc Ridey

unread,
Jun 9, 2010, 4:06:18 AM6/9/10
to google-map...@googlegroups.com
If you don't want the markers to appear by default in the panorama, use a custom panorama.
You can still give it the same DIV as the map if you want them to appear at the same location.
Just have:

var map = new google.maps.Map(div, ...);
var panorama = new google.maps.StreetViewPanorama(div, ...);
map.setStreetView(panorama);

There a few threads in the group on the same subject.

Marc

To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.

gardnose

unread,
Jun 9, 2010, 5:45:15 AM6/9/10
to Google Maps JavaScript API v3
Ah, got it now.

I was adding the panorama object after adding the markers, and this
wasn't working.

So the logic is now:
1 - create map
2 - add custom panorama (set lat/lngs, close button etc)
3 - set panorama to be hidden: panorama.setVisible(false);
3 - add markers to street map

This works as expected, although it's a little slow on initial load
because it's initialising the custom panorama. Feels like there could
be a better way to do this...


Thanks,
Gavin

On Jun 9, 9:06 am, Marc Ridey <mri...@google.com> wrote:
> If you don't want the markers to appear by default in the panorama, use a
> custom panorama.
> You can still give it the same DIV as the map if you want them to appear at
> the same location.
> Just have:
>
> var map = new google.maps.Map(div, ...);
> var panorama = new google.maps.StreetViewPanorama(div, ...);
> map.setStreetView(panorama);
>
> There a few threads in the group on the same subject.
>
> Marc
>
> On Wed, Jun 9, 2010 at 5:54 PM, gardnose <in...@abergavenny.org.uk> wrote:
> > Thanks Marc,
>
> > Think I'm still missing something here. What I want is to use
> > 'streetViewControl:true' to enable the pegman control.
> > Then when I drop the pegman onto the map, I'd like to hide the
> > markers.
>
> > You can see what I'm trying to do here:
> >http://www.abergavenny.org.uk/accommodation.htm
>
> > I've just had a look through this thread but can't find what I'm
> > looking for:
>
> >http://groups.google.com/group/google-maps-js-api-v3/browse_thread/th...
> > <google-maps-js-api-v3%2Bunsu...@googlegroups.com<google-maps-js-api-v3%252Buns...@googlegroups.com>
Reply all
Reply to author
Forward
0 new messages