StreetView and custom MapType.

242 views
Skip to first unread message

Charles Harvey

unread,
Mar 22, 2011, 1:03:25 PM3/22/11
to google-map...@googlegroups.com
Hi, All, I have implemented a custom MapType to serve my own tiles instead of the default tiles at particular locations, it works well. I am allowing users to change between map types as well, so that they can use SATELLITE or ROADMAP, etc. Here is my issue - when I set the map options to display the streetView pegman (streetViewControl: true), the pegman is displayed on SATELLITE and ROADMAP when I change the map type, but is never displayed on mine. Is it possible to use the default implementation of StreetView with a custom mapType? My code to set up the map is below, I can post an example if needed but I think the issue is fairly clear.

Thanks!


    /* This is the custom type that allows us to add our own images. */
    function CustomImageMapType() {}
    CustomImageMapType.prototype.tileSize = new google.maps.Size(256, 256);
    CustomImageMapType.prototype.maxZoom = 19;
    CustomImageMapType.prototype.isPng = false;
    CustomImageMapType.prototype.getTile = function(coord, zoom, ownerDocument) {

        // If we should be serving the image, not google.
        if (withinBoundaries(zoom, coord.x, coord.y)) {
        // not important for example..... tile gets served here
        }
        // If we don't have an image to serve, default to the regular map.
        return map.mapTypes.get(google.maps.MapTypeId.ROADMAP).getTile(coord, zoom, ownerDocument);
    };


    CustomImageMapType.prototype.name = "Penn";

    var pennCustomImageMapType = new CustomImageMapType();

    // Create the map options.
    var myOptions = {
        zoom: 16,
        mapTypeId: 'Penn',
        maxZoom: 18,
        streetViewControl: true,
        streetViewControlOptions: {
            position: google.maps.ControlPosition.BOTTOM_RIGHT
        },
        mapTypeControl: true,
        mapTypeControlOptions: {
              style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
              mapTypeIds: ['Penn',
                          google.maps.MapTypeId.ROADMAP,
                          google.maps.MapTypeId.TERRAIN,
                          google.maps.MapTypeId.SATELLITE,
                          google.maps.MapTypeId.HYBRID ]
          },
    };

    // Create the map.
    map = new google.maps.Map(document.getElementById("map"));


    // Now attach the custom image map type to the map's registry
    map.mapTypes.set('Penn', pennCustomImageMapType);

    // We can now set the map to use the 'custom image' map type
    map.setMapTypeId('Penn');

    // Add the options to the map.
    map.setOptions(myOptions);

Nianwei Liu

unread,
Mar 22, 2011, 5:07:23 PM3/22/11
to Google Maps JavaScript API v3
I think it's something broken in the recent 3.4 release. reverse to
old 3.3 release, create a simple page, and file a bug at issue page.

giscoda

unread,
May 4, 2011, 7:12:19 AM5/4/11
to Google Maps JavaScript API v3
Hi Charles,

I am experiencing exactly the same problem in 3.4. Did you find a
solution other than rolling back to 3.3?

Thanx

Brady E

unread,
Jun 25, 2011, 6:02:50 AM6/25/11
to Google Maps JavaScript API v3
Ditto, also ran into this and have not found a solution other than
reverting back to 3.3. Anyone?

Rossko

unread,
Jun 25, 2011, 8:05:05 AM6/25/11
to Google Maps JavaScript API v3
Maybe if one of you provides a simple demonstrator online and files an
issue report, it would get addressed?

Brady E

unread,
Jun 25, 2011, 11:32:51 AM6/25/11
to Google Maps JavaScript API v3
I don't know if I would immediately consider it a bug. The maptype
examples are simple enough demonstrators (
http://code.google.com/apis/maps/documentation/javascript/examples/maptype-image.html
) and I could see why they may not want to show the streetview guy for
all custom map types. In the moon example, if you switch it to v3.3,
you get the streetview marker and can streetview the underlying map
location, arguably undesirable behavior in that example.

So I guess more what I'm asking is, has anyone determined a work
around or undocumented property or something, that Google looks for in
it's own MapTypes that indicates it should show streetview.

thebasa

unread,
Jul 1, 2011, 1:24:41 PM7/1/11
to Google Maps JavaScript API v3

giscoda

unread,
Aug 15, 2011, 8:00:29 AM8/15/11
to Google Maps JavaScript API v3
There is a issue report relating to this bug: Issue 3189
https://code.google.com/p/gmaps-api-issues/issues/detail?id=3189
And I have provided a test link: http://karte.immobilien-kompass.de/wohnen/hamburg#karte
(pegman icon is grey in V3.3 and completely gone in > V3.3)

Are there any workarounds for this bug? How can I force pegman icon
appear correctly in my custom map types?

Chris Broadfoot

unread,
Aug 16, 2011, 9:03:35 PM8/16/11
to google-map...@googlegroups.com
Hi Steffen,

This is something we're changing in the 3.6 release. Pegman will be shown on custom map types.

Please begin testing against the nightly release:
--
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.


Bill Chadwick

unread,
Feb 8, 2012, 5:14:30 PM2/8/12
to google-map...@googlegroups.com
Still getting the Pegman left behind after doing setVisible(false) on a map's streetview when the map was started showing a custom map layer.

I am using

http://maps.google.com/maps/api/js?sensor=false&libraries=panoramio&libraries=geometry

example here

http://mortimermaps.appspot.com/wtp3/wtp3.htm

1) Set the left map to a non-google map e.g. OS, using the dropdown,
2) Refresh the page (to ensure a start with a non-google map on the left)
3) Drop the pegman on the left, non-google map ,
4) Press the Close SV button - pegman is left behind.
5) Switch map type to a Google map - pegman disappears

Seems to come right after a switch to a Google map and back.



Reply all
Reply to author
Forward
0 new messages