Stamen Map Toner substr error Google Maps Api - javascript

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

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

Related

Google Maps Fullscreencontrol showing blank on Android and Chrome - Ionic

I have integrated google maps in my ionic 2 project and it was working fine until I got the requirement to add the full screen option. I added the line, tested on google chrome, and when i clicked on full screen I got a blank screen. Compiled on Android, same problem. However it is working fine on Mozilla and IE. This is my code
this.platform.ready().then(() => {
let latLng = new google.maps.LatLng(-31.563910, 147.154312);
let mapOptions =
{
center: latLng,
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP,
fullscreenControl: true
}
this.map = google.maps.Map(this.mapElement.nativeElement, mapOptions);
this.mapCluster.addCluster(this.customersView.paginatedCustomers, this.map);
});

How to implement div as marker in to google maps api

Is there any possibilities in google maps api to implement **div* as marker. I have seen almost similar one in a national geographic website. but unfortunately keep on fail when implement that function in to my map :(
Does it work when use as opened infoindow ?
var options = {
zoom: 14,
center: mycity,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
My work http://jsfiddle.net/gbqzQ/2/
looking for something like this working demo:-http://natgeo125.appspot.com/

Google Maps Weather Layer No Longer Works Since Google Update

I understand that Google updated their map a day or two ago. Since the update, the weather layer no longer works on the webpage I am building. I have a MacBook Air with Apache server installed.
When the map loads the marker still works and the latitude and longitude are correct, but the city names no longer show nor does any of the weather features.
Here is what I have tried to fix the issue:
* I tried the three different web browsers that I have installed on my MacBook - Firefox, Safari, Google. Same issue in all three.
* I tried turning my Mac off and back on again.
* I went to the Google maps API website and according to that my coding is correct.
* If I do set the zoom property to 13, the city names will show up but no weather layer...which I understand is the proper behavior with a zoom setting of 13 or higher.
* On the Google maps API website, I copied and pasted the example code for the weather layer and it worked! They have a latitude and longitude of a country outside of the USA. I compared my coding to the example coding and my coding is the same, except for the latitude and longitude. SO, when I changed the latitude and longitude in the example coding to another location the weather layer stopped working.
Here is my code, but it seems to me that the issue is on Google's end. It was suggested that I post the question here (I already posted this question at productforums.google.com) because employee's from Google will see this question.
var map;
function initialize()
{
var mapOptions =
{
center: new google.maps.LatLng(40.0157394, -105.2792435),
/*center: new google.maps.LatLng(49.265984,-123.127491),*/
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
position: google.maps.ControlPosition.TOP_LEFT
},
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL,
position: google.maps.ControlPosition.LEFT_CENTER
}
};
map = new google.maps.Map(document.getElementById("gmap"), mapOptions);
/* Weather */
var weatherLayer = new google.maps.weather.WeatherLayer({
temperatureUnits: google.maps.weather.TemperatureUnit.FAHRENHEIT
});
weatherLayer.setMap(map);
var cloudLayer = new google.maps.weather.CloudLayer();
cloudLayer.setMap(map);
/* Marker & InfoWindow */
var marker = new google.maps.Marker(
{
position: mapOptions.center,
map: map
});
var text = '<div id="mapText">' + 'I live in beautiful Boulder, CO!' + '</div>';
var infowin = new google.maps.InfoWindow(
{
content: text,
pixelOffset: new google.maps.Size(0, 20)
});
infowin.open(map, marker);
google.maps.event.addListener(marker, 'click', function()
{
infowin.open(map,marker);
});
};
google.maps.event.addDomListener(window, 'load', initialize);
To work around the issue for now, I set my zoom to 13 so at least the city and street names will show, and the weather features are disabled when zoom is set to 13 or higher.
I'm pretty sure my coding is correct. Any ideas will be appreciated.

Using Google Maps in a web app for iPad

Is there a special way to call the Google Maps API in HTML for a web app for Mobile?
I am currently calling them in the standard way.. i.e.
<%= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false" %>
lat = 53.80620266482967
lng = -3.205146811523491
latlng = new google.maps.LatLng(lat, lng)
options =
zoom: 6
center: latlng
mapTypeId: 'OSM'
panControlOptions:
position: google.maps.ControlPosition.TOP_RIGHT
zoomControlOptions:
position: google.maps.ControlPosition.TOP_RIGHT
mapTypeControlOptions:
mapTypeIds: ['CloudMade', 'OSM', google.maps.MapTypeId.ROADMAP]
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
position: google.maps.ControlPosition.TOP_RIGHT
#gMap = new google.maps.Map(document.getElementById("map"), options)
#gMap.mapTypes.set('OSM', osmMapType)
#gMap.mapTypes.set('CloudMade', cloudMadeMapType)
#gMap.setMapTypeId(cloudMadeMapType)
But they seem a little slow and very jolty, not as smooth as the native app... anyone done this before. I would like to have them as smooth as possible.
Doesn't matter if you use the standard way, or any other way - the map will show up anyways on pretty much any device( including iPad ), but it will most likely be "jolty" and "slow". After all, you are are running it inside a web browser.
There are, however, special jQuery plugins that can be used for developing Google Maps applications for mobile devices( e.g. jquery-ui-map ).

Traffic layer in Google Maps

I'm trying to show the traffic layer for this location:
map
According to: Google Documentation I should only do this:
var myLatlng = new google.maps.LatLng(34.04924594193164, -118.24104309082031);
var myOptions = {
zoom: 13,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(map);
But the traffic layer is not shown.
I've checked this: coverage spreadsheet and it says it is not covered, but if I go to maps.google.com and search that location I can see traffic layer.
Is this not open to the developer community? Is something that needs to be paid to be used?
Not all data you see on maps.google.com are available inside the API, it's the decision of the owners of the data to spread their property for free or not.

Categories

Resources