Google Map API v3 - Maximum call stack size exceeded

I have been developing a JS widget for the last 5 or 6 weeks. The idea is that it can be added to any site by simply adding a href to the remote .js file and also a DIV container with a given ID to contain the contents of the widget.

The widget makes extensive use of Google Map API and I am referencing it as follows:

https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,places&callback=initializeGoogleMaps

When the widget is loaded, it will ask the user permission to check their location and then perform, amongst other operations, a simply geocoding for the location so that a marker can be plotted on the map.

Everything has been working perfectly and I must've tested the searching over 2,000 during development.

I deployed the widget yesterday and successfully embedded it into a host website - everything worked as perfectly as it always has done. This morning, however, my widget is falling over with Chrome's console reporting:

Uncaught RangeError: Maximum call stack size exceeded{main,geometry,places}.js:27 (anonymous function)VM530:33 cVM530:33 TT.(anonymous function).fitBounds{main,geometry,places}.js:48 (anonymous function){main,geometry,places}.js:26 Uf{main,geometry,places}.js:48 O.fitBoundsWRAPPostcodeLocator.js:1541 setupPageWRAPPostcodeLocator.js:964 jQuery.ajax.successjquery.js?time=95944:3 jjquery.js?time=95944:3 k.fireWithjquery.js?time=95944:12 xjquery.js?time=95944:12 b.onload.b.onreadystatechange

Since the widget last worked, no changes have been made to my code or the host, so I suspect something wrong with the Google API.

An example of my widget embedded into a dummy host can be seen at:

http://pcl.solsticecloud.co.uk

Having spent several hours trying to get to the bottom of this, I'm still non the wiser.

Any help or advice would be so much appreciated.

Thank you in advance,

Matt

Thanks Matt Alexander this was exactly the problem and the solution, however it seems that Google changed the names of the Location properties AGAIN, not .k and .D anymore, now its .A and .F!, take a look at the following console log:

Google Maps API, Google Groups allows you to create and participate in online forums and Google Maps API - too much recursion / Maximum call stack size exceeded� Viewing the stack. Consider this code (function a() { a(); })(); Here is the stack after a handful of calls As you can see, the call stack grows until it hits a limit: the browser hardcoded stack size or memory exhaustion. In order to fix it, ensure that your recursive function has a base case which is able to be met

For nowadays it's '.G' and '.K'. And as said - it's better to use '.lat()' and '.lng()'.

Maximum call stack size exceeded when using Google Maps � Issue , Using Google Maps API v3 I'm getting the following error message when using Ember 3.6.0. It works fine in Ember 3.5.1. Uncaught RangeError:� Google Maps JavaScript API V3 Reference Last updated Tuesday, May 26, 2020 This is an index of all the classes, methods, and interfaces in the Maps JavaScript API version 3.41 (weekly channel).

You can also use

 keys = Object.keys(LatLng);
 geometry.location[keys[0]]; // Obtain value for latitude

Setdrawingmode(null) giving Uncaught RangeError: Maximum call , google.maps.event.addListener(drawingManager, 'polygoncomplete', function ( polygon) { if (drawingManager.getDrawingMode() === null) { return; } else { do � If your API usage reaches your billable quota limit on any given day, your application will not be able to access the API for the remainder of that day. Related resources. Google Maps Platform Billing; Google Maps Platform Reporting; Premium Plan customers. For more information, see Premium Plan Usage Rates and Limits.

I have found the cause of this issue and have a fix.

I was using the following code:

        address = document.getElementById("strSearch").value;

    geocoder.geocode({ 'address': address, componentRestrictions: { country: 'GB' } }, function (results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            toggleModal();

            deleteMarkers();
            deleteBanks();

            searchSourceLatLng = new google.maps.LatLng(results[0].geometry.location.k, results[0].geometry.location.B);
            setSearchPointPostcode(results, buildResults);
        }

        else {
            callback();
        }
    })

The particular line that caused the issue is:

searchSourceLatLng = new google.maps.LatLng(results[0].geometry.location.k, results[0].geometry.location.B);

".B" has worked for weeks, but now it would seem that is no longer a valid property. Instead, ".D" works and so my code now works.

As the property was no longer valid, I had a LatLng object with a null value and this caused the map to crash when I tried to see my map boundaries.

I would love to know how or why this has changed in the API.

Also, a stupid question I'm sure, but why ".k" and ".D"? What's wrong with ".Lng" and ".Lat"?

Glad it's sorted though, just hope the API doesn't change again.

[RF-13459] Google map doesn't work because of stack overflow , Uncaught RangeError: Maximum call stack size exceeded %7Bmain,adsense, geometry,zombie%7D.js:11 Map.disableContinuousZoom is no longer supported in the Google Maps Javascript API v2. to migrate your application to v3. mbykovskyy changed the title Setting latitude/longitude to NaN causes RangeError: Maximum call stack size exceeded Setting latitude/longitude to not a Number type causes RangeError: Maximum call stack size exceeded Sep 20, 2014

You can loop over the properties of location and get the coordinates without accessing its properties directly:

geocoder.geocode({ 'address': value.address }, function (results, status) {
if (status === google.maps.GeocoderStatus.OK && results.length > 0) {

    var coords = [];
    for (var key in results[0].geometry.location) {
        coords.push(results[0].geometry.location[key]);
    }
    return {
        'latitude': coords[0],
        'longitude': coords[1]
    };
}
});

Maps JavaScript API Usage and Billing, To view the quota limits, scroll down to the Advanced maps loads card. A table lists the quota names and limits. To change a quota limit, click the Edit icon for that� The size parameter of the Maps Static API defines the size of a map in pixels, so that a map with size=200x200 will be returned as 200 pixels by 200 pixels. On an LCD computer monitor, which typically displays about 100 pixels per inch (ppi), a 200x200 map will be about 2 inches in each dimension.

Google Maps Platform FAQ, Map size and location for retrieving map tiles and copyrights; Addresses for If you exceed the QPS limits of a given Google Maps Platform product, the API will return an For instance, on the Maps JavaScript API, 28,000 calls can be made per Google's Developer Relations team maintains a presence on Stack Overflow� As a result, map images within Google Maps and the Maps JavaScript API are broken up into map "tiles" and "zoom levels." At low zoom levels, a small set of map tiles covers a wide area; at higher zoom levels, the tiles are of higher resolution and cover a smaller area.

Google Map API v3, I have been developing a JS widget for the last 5 or 6 weeks. The idea is that it can be added to any site by simply adding a href to the remote .js file and also a� The Google Maps Platform is a set of APIs and SDKs that allows developers to embed Google Maps into mobile apps and web pages, or to retrieve data from Google Maps. There are several offerings. Depending on your needs, you may find yourself using one or a combination of these APIs and SDKs:

Uncaught RangeError: Maximum call stack size exceeded when I , Uncaught RangeError: Maximum call stack size exceeded when I use google maps. Question LatLng(x.lat, x.lng); var marker = new google.maps.Marker({� Another thing you could try is to try it outside of the XDK, i.e. build a simple web app that does the same call, open it up in Chrome and see if it shows the same behavior. The difference I see between With and without the key is only on the call to "apiLoad", where the parameters are different, i think.

Comments
  • Don't use the experimental version in production, it can break at any time.
  • Undocumented properties are undocumented for a reason: they are not part of the public API and could change at any time. The correct way to access the latitude and longitude of a LatLng object is by calling the lat() and lng() methods as documented in the reference.
  • I think google is intentionally keeping us developers on our toes. I ran into this issue but my code differers a bit more since the time of this post. From .G and .K to .H and .L (I believe those are coming from markers positions.
  • @Yaniv the geocoder.geocode function doesn't return a LatLng object. So you can't call lat() or lng() on the returned response.
  • @inorganik GeocoderResult.geometry.location is a LatLng object.
  • This is odd, you answered this on September 1st, and it seems now on the 15th with the latest copy of google maps api, this .G and .K has changed to .H and .L. Though I am up voting this, as this should be the answer. lat() and lng() are the way to go if you don't want to maintain the code in future releases.
  • While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.
  • Beware that older browsers don't support this ES5 feature.
  • Google's Map API has changed. The results are no longer properties, but methods, lat() and lng() respectively. They can be called to obtain the proper values instead.
  • The correct way to access the latitude and longitude of a LatLng object is by calling the lat() and lng() methods as documented in the reference. Values like .k and .D are automatically generated by the Closure Compiler and can (and, as you've observed, do!) change at any time. Only documented object properties should be used if you wish your implementation to be reliable.
  • I second that comment. Any one-letter variable names are automatically generated during an optimization phase and are never intended to be called directly. Read the docs on how to use these objects properly, and you'll see that there are legitimate public methods to access