views:

37

answers:

1

How can I use Google Maps API to show me a full screen map with no sidebars or search bar? I just need it to show a specific location in a mobile app, users don't need to search. Is this possible?

Also if I provide a street address how can it put a push-pin at the location?

A: 

Assuming you are planning to use the v3 API, you may want to check the following section of the documentation:

As for your second question, you can use Geocoding. Consider the following simple example:

<!DOCTYPE html>
<html> 
<head> 
   <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
   <title>Google Maps Geocoding Demo</title> 
   <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
   <script src="http://maps.google.com/maps/api/js?sensor=false" 
           type="text/javascript"></script> 
   <style type="text/css">
     html { height: 100% }
     body { height: 100%; margin: 0px; padding: 0px }
     #map { height: 100% }
   </style>
</head> 
<body> 
   <div id="map"></div> 

   <script type="text/javascript"> 

   var address = 'Oxford Street, London, UK';

   var map = new google.maps.Map(document.getElementById('map'), { 
       mapTypeId: google.maps.MapTypeId.TERRAIN,
       zoom: 12
   });

   var geocoder = new google.maps.Geocoder();

   geocoder.geocode({
      'address': address
   }, 
   function(results, status) {
      if(status == google.maps.GeocoderStatus.OK) {
         new google.maps.Marker({
            position: results[0].geometry.location,
            map: map
         });
         map.setCenter(results[0].geometry.location);
      }
      else {
         // Google couldn't geocode this request. Handle appropriately.
      }
   });

   </script> 
</body> 
</html>

Screenshot:

Full Screen Google Map

Daniel Vassallo