[I-mobile-u] google maps v3 sample
Derek Morr
derekmorr at psu.edu
Mon Feb 15 11:31:54 EST 2010
As I mentioned on last week's call, I'm experimenting with v3 of the
Google Maps API.
I had noticed that the campus map building info page was blocking while
loading the javascript map. I moved the initialize() function further
down the page (at the end of the main container div), and that helped a
bit. When I switched to the v3 API, the page loads much faster (about
2.5x faster according to firebug).
Sample v3 script (apologies for lack of formatting):
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(40.804163675046, -77.8550381586516);
var myOptions = {
zoom: 16,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
var bldgmarker = new google.maps.Marker( {
position: latlng,
map: map
} );
}
</script>
You can see this at http://m.et-test.psu.edu/map
The v3 javascript download is much smaller, and it doesn't require a map
key. More info at the Google I/O talk last year -
http://code.google.com/events/io/2009/sessions/MapsApiMobile.html
-derek
--
Derek Morr
Senior Systems Programmer
Emerging Technologies, Information Technology Services
The Pennsylvania State University
derekmorr at psu.edu
This email was sent (at least in part) over IPv6.
More information about the I-mobile-u
mailing list