views:

53

answers:

3

I have a web application. I want to integrate the Google Maps to show the map of a location where user types in the search location. Any help?

A: 

STEP 1: Open the map you want to embed. It could be a map you created under my maps tab, or a search for address, local business or driving directions.

STEP 2: Copy the HTML code from the textbox after clicking "Link to this page". You can also customize the size of the map and preview it before embedding.

STEP 3 : Paste the HTML code into your website or your blog editor.

or else See this site http://www.higheredblogcon.com/library/deweese/presentation.html

RSK
A: 

what you need is

geocoding (a way to turn an address to a long,lat) http://code.google.com/apis/ajax/playground/#geocoding_simple

and a simple map http://code.google.com/apis/ajax/playground/#map_simple

Circadian
A: 

If I understood your question correctly, you want your users to search for a location, and then display it on the map. If this is the case, that can be done very easily, using the Geocoding Services provided by the Google Maps JavaScript API. Consider the following example:

<!DOCTYPE html>
<html> 
<head> 
   <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
   <title>Google Maps Geocoding Demo</title> 
   <script src="http://maps.google.com/maps/api/js?sensor=false" 
           type="text/javascript"></script> 
</head> 
<body> 
   <div id="map" style="width: 400px; height: 300px;"></div> 

   <script type="text/javascript"> 

   var address = 'London, UK';

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

   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:

Google Maps v3 Geocoding Demo

You can simply substitute the value of the address variable, which in this example is set to 'London, UK' to the location searched by your users.

Daniel Vassallo