When using the following code under Firefox 3, I am getting an out of memory error. This is the error given: [Exception... "Out of Memory" nsresult: "0x8007000e (NS_ERROR_OUT_OF_MEMORY)" location: "JS frame :: http://maps.gstatic.com/intl/en_us/mapfiles/211b/maps2.api/main.js :: anonymous :: line 337" ]
This code used to work fine about 1 month ago when I last tested it. It works under IE 6 just fine (if I remove the try/catch blocks). You can try the code here: http://www.rimi.org/testing/GoogleMapCenterOnLatLong.html. Just zoom a bit and see the markers placed around Chicago, IL in the USA. Any suggestions? <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/ > <title>Google Maps JavaScript API Example</title> <script src="http://maps.google.com/maps? file=api&v=2.x&key=[mykey]&sensor=false" type="text/javascript"></script> <script type="text/javascript"> geocoder = null; globalpoint = null; minLon = 0; maxLon = 0; minLat=0; maxLat=0; geocoder = new GClientGeocoder(); var number = 1; mynumpnts = 0; pointsencoded=0; points= new Array(); function createMarker(point,html) { var marker = new GMarker(point); points[mynumpnts]= point; mynumpnts=mynumpnts+1; document.write ("before listener"); GEvent.addListener(marker, "click", function() { map.openInfoWindowHtml(point, html); }); document.write ("after listener"); pointsencoded=pointsencoded+1; document.write ("after pointsencoded"); if (pointsencoded>=maxPoints) { //alert("before fitmap"); document.write ("before fitmap"); document.write(points); try { fitMap(map,points); } catch (e) { document.write('Error: ' + e ); } document.write ("after fitmap"); } return marker; } function initialize() { } function fitMap( map, points ) { var bounds = new GLatLngBounds(); for (var i=0; i< points.length; i++) { bounds.extend(points[i]); } map.setZoom(map.getBoundsZoomLevel(bounds)); map.setCenter(bounds.getCenter()); } function showAddress(address) { if (geocoder) { geocoder.getLatLng(address,function(point) { if (!point) { alert(address + " not found"); } else { // var marker = createMarker(point,address); document.write("back from createmarker"); document.write("start default icon"); var blueIcon = new GIcon(G_DEFAULT_ICON); document.write("start get marker"); blueIcon.image = "http://maps.google.com/mapfiles/marker" + String.fromCharCode(64 + mynumpnts) + ".png"; markerOptions = { icon:blueIcon }; document.write("start addoverlay"); document.write("point:" + point); document.write("markeroptions:" + markerOptions); var tempmarker = createMarker(point,address); document.write("back from createmarker"); try { map.addOverlay(tempmarker); } catch (e) { document.write('Error: ' + e + '\nMarker: ' + tempmarker); } document.write("back from addoverlay"); if (point.x < minLat) {minLat = point.x;} if (point.x > maxLat) {maxLat = point.x;} if (point.y < minLon) {minLon = point.y;} if (point.y > maxLon) {maxLon = point.y;} document.write (String.fromCharCode(64 + mynumpnts) + ":" + address + "<br>"); } } //endfunction definition ) //end getlatlng function } } </script> </head> <body onload="initialize()" onunload="GUnload()"> <div id="map_canvas" style="width: 1000px; height: 500px"></div> <script type="text/javascript"> var map = new GMap2(document.getElementById("map_canvas")); map.setUIToDefault(); map.setCenter(new google.maps.LatLng(0, 0), 13); maxPoints=1; showAddress("123 st, city, st 12345"); </script> </body> </html> -- You received this message because you are subscribed to the Google Groups "Google Maps API" 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-api?hl=en.
