Monday, July 26, 2010

Google maps API v3 - Part 1 - How to create a simple map?

Recently I worked on a project using Google maps. It was originally developed using Google maps API v2. I changed it to use v3 API.

Google maps v2 vs v3 API

Version 2 API requires you to register for an API key for every domain that uses google maps and must be inserted into the QueryString for the script reference. Version 3 API doesn't require an API key.

How to create a simple map?

1. First thing is to add the following script reference to your HTML page.


Note: sensor attribute is to specify whether your device has a sensor or not. (just to determine the user's location.

2. Create an object with the latitude and longitude co-ordinates. Simple map with NZ co-ordinates.

No comments:

Post a Comment