Just realized that I was looking at an old source. ImageMapTypes don't
have a setMap method, so you'll need to use something more along the
lines of:

var TileOverlay = new google.maps.ImageMapType({...});
var TileOverlayIndex = map.overlayMapTypes.push(BuildingsLayer) - 1;
google.maps.event.addListener(map, 'maptypeid_changed', function () {
        if (this.getMapTypeId() != google.maps.MapTypeId.ROADMAP &&
this.getMapTypeId() != google.maps.MapTypeId.HYBRID &&
TileOverlayIndex != -1) {
            map.overlayMapTypes.removeAt(TileOverlayIndex);
            TileOverlayIndex = -1;
        }
        else if ((this.getMapTypeId() ==
google.maps.MapTypeId.ROADMAP
|| this.getMapTypeId() == google.maps.MapTypeId.HYBRID) &&
TileOverlayIndex = -1)
            TileOverlayIndex =
map.overlayMapTypes.push(BuildingsLayer) - 1;
    });

Chad Killingsworth

On Sep 28, 4:17 pm, Chad Killingsworth
<[email protected]> wrote:
> Here's a basic example of what you want to 
> do:http://search.missouristate.edu/map/mobile/examples/tileoverlay.htm
>
> Now to remove the overlay on certain map types, use something like:
>
> google.maps.event.addListener(map, 'maptypeid_changed', function () {
>         if (this.getMapTypeId() != google.maps.MapTypeId.ROADMAP &&
> this.getMapTypeId() != google.maps.MapTypeId.HYBRID) {
>             TileOverlay.setMap(null);
>         }
>         else if ((this.getMapTypeId() == google.maps.MapTypeId.ROADMAP
> || this.getMapTypeId() == google.maps.MapTypeId.HYBRID) &&
> TileOverlay.getMap() == null) {
>             TileOverlay.setMap(map);
>         }
>     });
>
> Chad Killingsworth
>
> On Sep 28, 3:04 pm, PhilR8 <[email protected]> wrote:
>
>
>
> > Here's my map:
>
> >http://pages.towson.edu/preese/campusmapv3/test/overlay2.html
>
> > So we have the standard RoadMap and a Towson Maptype.  The "Towson"
> > maptype is right now constructed as a basemap type.  What I would like
> > to do is overlay the towson tiles on top of the RoadMap and having
> > them combined be their own separate Maptype - so when you would selec
> > Satellite or Map, the overlay tiles wouldn't appear, as they would
> > only be attached to the Towson maptype.
>
> > I've been trying to piece this together using the API reference,
> > tutorial, and some examples I've found from the forum (like this 
> > one:http://www.darkmatters.org/Map/S2IBmap.html) but progress is slow and
> > I'm hoping someone out there has an example that is similar to what I
> > describe above.  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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to