[Google Maps API v3] Error setting ImageMapType

1,141 views
Skip to first unread message

Alon Salant

unread,
Apr 20, 2010, 9:03:00 PM4/20/10
to Google Maps JavaScript API v3
I am trying to add a new MapType (not an overlay) with my own tiles.
Using the example code at http://code.google.com/apis/maps/documentation/v3/overlays.html#ImageMapTypes
and providing my own getTileUrl function, my image tiles render great
as an overlay.

However, I want a new MapType not an overlay. My understanding (from
http://code.google.com/apis/maps/documentation/v3/reference.html#MapTypeRegistry)
is that I should be adding the ImageMapType to Map.mapTypes with:

map.mapTypes.set('ID', myImageMapType);

This results in the JavaScript error "Expected value implementing
google.maps.MapType"

You can reproduce this error by using the traffic example at
http://code.google.com/apis/maps/documentation/v3/overlays.html#ImageMapTypes
and replacing:

map.overlayMapTypes.insertAt(0, trafficMapType);

with

map.mapTypes.set("traffic", trafficMapType);

This implies that you can't use ImageMapType as a standalone MapType
or I've misunderstood something along the way.

Any insights?

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

Ben Appleton

unread,
Apr 21, 2010, 12:20:09 AM4/21/10
to google-map...@googlegroups.com
MapType .maxZoom is a required property for base MapTypes:
http://code.google.com/apis/maps/documentation/v3/reference.html#MapType

.maxZoom has no effect for overlay MapTypes, which is why the traffic example worked as-is but failed when you set traffic as the base MapType.

Alon Salant

unread,
Apr 21, 2010, 12:43:36 AM4/21/10
to google-map...@googlegroups.com
That was it. Wasn't clear to me from the docs that it is required.

Thanks,

Alon



On Tue, Apr 20, 2010 at 9:20 PM, Ben Appleton <appl...@google.com> wrote:
> MapType .maxZoom is a required property for base MapTypes:
> http://code.google.com/apis/maps/documentation/v3/reference.html#MapType
>
> .maxZoom has no effect for overlay MapTypes, which is why the traffic
> example worked as-is but failed when you set traffic as the base MapType.

Ben Appleton

unread,
Apr 21, 2010, 7:02:22 PM4/21/10
to google-map...@googlegroups.com
I'll clear that up, should go live with the next reference push.

Ben
Reply all
Reply to author
Forward
0 new messages