Monday, January 17, 2011

Polygon

    After having seen a number of examples of polyline using the Google Maps API, the obvious next step is to create polygons on the map! Today, we will start with a simple polygon example and later proceed with a few more ranging from simple to a little more complex! Let us now move on to the code. Copy the following code in a text file and save the file with .html extension. Click on this html file and it will open in your web browser. You will now see your map in action!

    In this example we will see a hard-coded polygon, i.e. with no user interaction! No user-clicks, no drags, nothing at all! The polygon will directly appear on the map! Following is the code for the same.


    The output of the above code is as seen in the result section above. If you have any doubts or queries regarding the above code, leave a comment here or feel free to drop me a mail!