1) Getting the API key by signing upYou just need to accept the terms and conditions by Google, provide the URL of your website and confirm the registration to generate API key. You can apply for the key here: http://www.google.com/apis/maps/signup.html
2) Code for adding the Google map in the websiteNow that you have generated the API key, just add this code to your page. Copy the code snippet in your HTML page to get the Google map. Replace the “API_KEY_GENERATED” by the key received.
Getting the co-ordinates of latitude and longitude
The above code will generate the Google map for the location of ESDS Software Solution, India. The latitude and longitude of the desired location can be easily figured out from the web. Some websites provide you with the coordinates of a particular location on the basis of the name or address of that location.
An example of such a website is http://itouchmap.com/latlong.html
You can get the desired location in Google maps by just changing the coordinates.
Controlling DragFeature :
Drag is a default feature in Google maps that is if you move the mouse cursor over the map and press the button and drag it, the map becomes moveable. If you want to disable this feature just add the following code:
Scaling and repositioning toolbar is not available in Google maps API. To add this toolbar you can use the following code:
Some of the controls available are:
It is used for switching between satellite view and map view.
This is a smaller version of GlargeMapControl, By using this control you can eliminate the zooming scale bar but the zoom control remains the same.
This control includes only the zooming buttons, excluding everything else found in the GLargeMapControl.
Adding a Marker to your Map :
Google maps is a powerful tool but we can add more functionality and take the tool to next level by adding markers to the specific point in the map. It is simple too. Just find the coordinates (longitude and latitude) of the location you’d like to mark, instantiate a new GPoint() object with these coordinates, create a GMarker object based on this point, and finally add that marker to the map.
var point = new GPoint(19.997453,73.789802);var marker = new GMarker(point); map.addOverlay(marker);
Adding a location description to your marker:
Sometimes, just adding the marker is not enough. We have to be more precise with respect to the description of the location. Thus, we can add the description window to our marker. The following is the code snippet for adding a description to your marker.
This was just an introduction to the powerful service of Google maps. For more details, we can always check out the API documentation for Google maps on Google website.