|
Lead: Sherif
Topic: News - Is Microblogging ready for the Enterprise? URL Link(s):
Labels:
tech-news Agenda Template
Lead: John Topic: Web Development Frameworks Pt 1 URL Link(s):
Labels:
development, frameworks, php, opensource Lead: Shaun
Topic: Using the Google Maps API - Writing a Maplet URL Link: Key Points:
<script src="http://maps.google.com/maps?file=api&v=2.x&key=YOUR KEY HERE" type="text/javascript"></script> <script type="text/javascript"> var map = null; var geocoder = null; var isFirst = true; function initialize() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(-33.867139, 155.207114), 13); map.addControl(new GSmallMapControl()); geocoder = new GClientGeocoder(); } showMultipleAddresses('<?=$suburbString /* easy hey just generate a comma seperated list here :) */?>'); } function showAddress(address) { if (geocoder) { geocoder.getLatLng( address, function(point) { if (!point) { //do nothing } else { if (isFirst) { map.setCenter(point, 10); isFirst=false; } var marker = new GMarker(point); map.addOverlay(marker); //marker.openInfoWindowHtml(address); GEvent.addListener(marker, "click", function() { var html = '<div style="width: 210px; padding-right: 10px"><strong>' + address + '<\/strong><\/div>'; marker.openInfoWindowHtml(html); }); GEvent.trigger(marker, "click"); } } ); } } function showMultipleAddresses(addresses) { var addArr = addresses.split(","); for ( var i=0; i<addArr.length; i++) //var i in addArr ) { showAddress(addArr[i]); } } <html> <head> <!-- place above javascript here --> </head> <body onload='initialize()' onunload='GUnload()'> <div id="map_canvas" style="width: 600px; height: 450px">The map couldn't render correctly.</div> </body> Labels:
development, google, javascript |