Google Maps full screen

What about having a full screen Google Maps APP?

It should be not so difficult, but what if we add street search, mouse wheel zoom, maps redimension and street view?

Example:(check source code for full implementation)
map barcelona

How does it work:

To have Google Maps in full screen we need a a bit of css+HTML:

 <style type="text/css">
  v\:* {behavior:url(#default#VML);}
 html, body {width: 100%; height: 100%}
 body {margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0px}
 </style>
<div id="map" style="width: 100%; height: 100%;"></div>

For the street search we need the geocoder and a input:

function showAddress(address) {
	 if (geocoder) {
		geocoder.getLatLng(address,
			function(point) {
				if (!point) {
					  alert(address + " not found");//no ecnontrado
				} else {
					map.setCenter(point, 16);
					map.addOverlay(createMarker(point));
					map.openInfoWindow(point,address);
					}
				 }
			);
	}
}
<form id="form" action="#" onsubmit="showAddress(this.address.value); return false;" >
	<input type="text" size="25" name="address" onclick="this.select();" value="address to search here" />
	<input type="submit" value="Search" />
</form>

Wheel zoom is really easy:

map.enableScrollWheelZoom();

Map redimension should work with something like this:

if (window.attachEvent)window.attachEvent("onresize", function() {this.map.onResize()} );

Street view implementation on a marker:

<div id="streetview" style="width: 100%; height: 100%;display: none;"></div>
function createMarker(p) {
   var marker = new GMarker(p);
 
   GEvent.addListener(marker, "click", function() {
	 st = new GStreetviewPanorama(document.getElementById("streetview"),{latlng:p});});  
 
    return marker;
}

As I said before check the source code of the example ;)

Share and Enjoy:
  • Twitter
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • BarraPunto
  • Bitacoras.com
  • FriendFeed
  • Meneame
  • Netvibes
  • Reddit
  • StumbleUpon
  • Tumblr
  • Wikio
  • RSS
  • email
  • PDF
  • Print

Related posts:

  1. How to install KDE 4.3 in Ubuntu Jaunty
  2. JavaScript to return dimensions
  3. Open Classifieds 1.5.1 Released
  4. Ping your sitemap.xml to Google
  5. f.lux – Better lighting for your screen in Ubuntu

Leave a Reply

Follow me