Not sure how you attach the attributes, to #map_canvas, but are they numbers?
The API expects you to be sending numbers (not strings) when creating a LatLng object. try wrapping them in parseFloat. If that guess doesnt help suggest supplying a link to your map. On Mon, Jan 30, 2012 at 10:34 PM, fearless_fool <[email protected]> wrote: > I'm getting the following error (show with stack trace) after my code > completes: > > Uncaught TypeError: Cannot read property 'type' of undefined > > Vcmain.js:7 > (anonymous function) > Ve.mainmain.js:40 > (anonymous function)main.js:25 > bmain.js:11 > Se.(anonymous function).kcmain.js:25 > Mmain.js:9 > Se.(anonymous function).kcmain.js:25 > Re.(anonymous function).Kdmain.js:24 > Se.(anonymous function).kcmain.js:25 > Wemain.js:25 > (anonymous function)%7Bcommon,util,controls,places_impl%7D.js:1 > > > Here's my js code (pretty straightforward): > > $(function() { > var loc = new google.maps.LatLng($('#map_canvas').attr('lat'), > $('#map_canvas').attr('lng')); > var maxZoomService = new google.maps.MaxZoomService(); > maxZoomService.getMaxZoomAtLatLng(loc, function(response) { > // zoom to maxZoom - 1 if we can determine it, 14 otherwise > var zoom = (response.status == google.maps.MaxZoomStatus.OK) ? > (response.zoom - 1) : 14; > var mapOptions = { > center: loc, > zoom: zoom, > mapTypeId: google.maps.MapTypeId.SATELLITE}; > var myMap = new > google.maps.Map(document.getElementById("map_canvas"), mapOptions); > }); > }); > > What makes this difficult to debug is that the TypeError happens deep inside > the google.maps.__gjsload__ code, long after my code has returned. I can't > figure out what state my code is creating that is causing the google library > code to choke. > > Any ideas, or suggestions on how to debug? > > -- > You received this message because you are subscribed to the Google Groups > "Google Maps JavaScript API v3" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-maps-js-api-v3/-/NDVqO_jXaDcJ. > 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-js-api-v3?hl=en. -- 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 [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-js-api-v3?hl=en.
