Thursday, January 20, 2011

Geodesic, Draggable Onclick Polygon

    After creating a simple polygon and then creating an on-click polygon, we will today see how to create a polygon which can be changed, altered, dragged; basically edited on the fly. We will also cover the geodesic polygon in this example itself. If you want to read and understand more about what "geodesic" is, read this post.

    Nothing exceptional about the code that I think needs explanation! You can create a geodesic polygon which can be edited on the fly. Click, hold and drag any marker, and the two polylines connected by this marker will change accordingly. By clicking on the marker, that marker would disappear, and the polygon will reform itself! Here is today's code.

    You can copy the above code in a text file and save it with .html extension. Click on this file; it will open in your default browser and you will see an exciting map in action! The output of the above code appears as seen in the result section above! If you have any doubts or queries regarding this code please leave a comment here or drop me a mail!