Skip to main content

Onclick polygon

    Yesterday we had a look at a simple polygon example. But that example was not exciting as it was all hard-coded with no user interaction and which means no fun! Today's example will deal with creating a polygon on the fly, i.e. an on-click polygon in action!

    The code for creating a polygon is very much similar to creating a polyline! The only difference is that you need to replace "Polyline" by "Polygon" in such examples. Let's head on to our code.


    The output of the above code can be viewed in the result section above. If you have any doubts or queries regarding the above code then please comment here or feel free to drop me a mail! Till then, happy mapping!

Comments

Recommended for You

The Bicycling Layer...

    Recreational cyclists and bike commuters alike can plot cycle-friendly routes, find trails, and avoid snarling traffic with Google Map's Bicycle layer. Map's bike-friendly, green-toned map layer is very eye-pleasing. The Google Maps API allows you to add bicycle information to your maps using the BicyclingLayer object.     The BicyclingLayer renders a layer of bike paths, suggested bike routes and other overlays specific to bicycling usage on top of the given map. Additionally, the layer alters the style of the base map itself to emphasize streets supporting bicycle routes and de-emphasize streets inappropriate for bicycles.     Let us have a look at the following example. The code has a map which is centered at Pune, India. There are very few cycle tracks in Pune and so you will see just a few dark green lines on the map. But if you would change the latitude-longitude values in the code and center the map at USA, then you will see a...

Playing with the markers and info window bubbles...

    In the last few posts, we have seen some marker examples and some information window examples. Now, lets do something interesting combining these two things. Just writing that "This is an info window" in the information bubble is not very interesting! And I know this...Have gone through the same phase!     So, today we will do something interesting! We will display the latitude- longitude co-ordinates of the point that the user clicks on the map! Doing this is not at all complex! Copy paste the following code and you will see for yourself a map coming to life!     The output of the above code looks as seen in the result section above! If you have any queries regarding the above code please comment on the blog post or feel free to contact me at my mail ID .

Google Map's Real-Time Traffic Layer...

    You can now check the traffic condition on the road before you leave for work, or a party or to your friend's place. Google's Traffic layer shows the traffic conditions in your area - LIVE!!! Live traffic data is available in major cities in the United States, France, Britain, Canada and Australia, with new cities and countries frequently added. The Google Maps API allows you to add real-time traffic information (where supported) to your maps using the TrafficLayer object. Traffic information is provided for the time at which the request is made. Consult this spreadsheet to determine traffic coverage support.     Let us now have a look at the Google Maps API - Trafiic Layer example. Copy the following code in a simple text file and save it as html. Click on this html file and it will open in your default browser. You will then see the traffic conditions in your area - LIVE...     The output of the above code looks as seen in the r...

100th Post...

            I’m so excited that I have finally reached this milestone. Well I am not completely certain that this is a big deal but anything that is ' 100 ' just seems big and grand. I have been blogging here for around 8 months now, and it gives me immense pleasure to say that now I have become an experienced blogger.:D             I never thought when I started this blog in November, 2010 that I would have much to offer compared to the hundreds of other GIS bloggers out there. But today with more than 21,000 page views, more than 100 comments, more than 100 followers and several Like and +1s the response to this blog has been nothing short of amazing. Now the next target for me would be to cross 50,000 views.             At the end, I would  like to thank all visitors and members for making this blo...

Follow Your World!

         Google now offers you a simple application that informs you by email each time we update the satellite and aerial imagery in your area of interest. Follow Your World is a free service that allows you to enter the lat/long of a location along with your email address. Whenever any imagery is updated for that location, an email alert will be sent.          Our surroundings are constantly changing, so it's no surprise that Google Earth and Google Maps users often request the most up-to-date satellite and aerial imagery. While Google can't necessarily update the world's imagery in real-time, they can let you know when they do update this imagery.          In just three easy steps, you can add points such as your hometown, your college, or just about any place on the Earth. Step 1. Find a location. Search for the area by entering the name of a country, state, ...