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);