Search code examples
javascriptgoogle-mapsstamen-maps

Stamen Map Toner substr error Google Maps Api


I've been using this Toner Map by Stamen for a while. I built it using Google Maps. Its been working on multiple sites for the last 5-6 months.

I just checked today as a client complained and they are all broken.

Stamen: http://maps.stamen.com/#watercolor/12/37.7706/-122.3782

Error:

Uncaught TypeError: Object [object Array] has no method 'substr' 

JS Fiddle: http://jsfiddle.net/hnuTt/12/

Javascript:

var layer = 'toner';
var map = new google.maps.Map(document.getElementById('map'),{
    center: new google.maps.LatLng(51.514635,-0.092992),
    zoom: 15,
    mapTypeId: layer,
    scrollwheel: false,
    disableDefaultUI: true,
    mapTypeControlOptions: {
        mapTypeIds: [layer]
    }
});
map.mapTypes.set(layer, new google.maps.StamenMapType(layer));
var marker = new google.maps.Marker({
    position: new google.maps.LatLng(51.499405,-0.390596),
    map: map
});

Solution

  • I had exactly the same problem with stamen and other tile providers.

    Since yesterday, default Google Maps API loaded (http://maps.googleapis.com/maps/api/js?sensor=false) seems to be version 3.13, which isnt the release version and might contains bugs.

    In emergency the solution is to load 3.12 version which is the release version : http://maps.googleapis.com/maps/api/js?v=3.12&sensor=false

    I haven't tried yet to find a working solution with 3.13