Thursday, March 31, 2011

Geocoding

    Geocoding is the process of converting addresses (like "Pune") into geographic coordinates (like latitude - 18.5193 and longitude - 73.8579), which you can use to place markers or position the map. The Google Maps API provides a geocoder class for geocoding addresses dynamically from user input. Accessing the Geocoding service is asynchronous, since the Google Maps API needs to make a call to an external server. For that reason, you need to pass a callback method to execute upon completion of the request. This callback method processes the result(s). To know more details about the geocoding requests, responses and results visit this link.

    Understanding the geocoding requests, responses and results is very important for proper understanding and execution of any geocoding functionality in Google Maps API v3. Let us have a look at the following example...



    The output of the above code will appear as seen in the results section above. The map is initially centered at India, with no text in the search box. Now you need to put in the address that you wish to geocode in the search box and then click on search. If the entered address is valid, a marker will appear on the map at the appropriate location.

    There is some level of error-handling done in this example using the status codes of the geocoding facility in Google Maps API. The status codes return several values depending upon whether the geocode was successful or not and whether any result was returned. The following image will show one such condition where the geocode was successful but did not return anything as the entered address was invalid.


    Some may find the above example a little complex, but the example is not complex at all, it is just that you need to understand the geocoding requests, responses, results and status codes. If anybody wants me to write in depth about the theory of the geocoding, then I will definitely try and write to explain the stuff in as simple language as possible. Till then...Keep mapping!
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Tuesday, March 29, 2011

Panoramia - Tag based search

    If you don't already know what Panoramia is, you can have a look at this link, to know more about Panoramia and a basic example. Today we will have a look at a more sophisticated example for Panoramia Layer in Google Maps API v3. In today's example we will search and display only those images on the map that have the tag that is being searched for.

    The example is very simple and all you need to do is copy the following code in an html and open it in your browser. Search for whatever you want to and if there are images that have the same tag, then those images will appear on the map.




    The output of the above code looks as it is seen in the result section above. Now you can enter your search parameter in the search box. I had entered "Fruits" and the output was as seen in the image below.


    You can have your own search parameter. Enjoy the Panoramia ride!
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Wednesday, March 23, 2011

Panoramio Layer...

    Let's start with the obvious question first...What is Panoramio? Panoramio is a geolocation-oriented photo sharing website. Panoramio website was officially launched on October 3, 2005 by Joaquín Cuenca Abela and Eduardo Manchón Aguilar, two Spanish entrepreneurs and was acquired by Google in July 2007.

    Accepted photos uploaded to the site can be accessed as a layer in Google Maps, with new photos being added at the end of every month. The site's goal is to allow Google Maps and Google Earth users to learn more about a given area by viewing the photos that other users have taken at that place. The website is available in several languages and can be viewed here.

    You may add photos from Panoramio as a layer to your maps using the PanoramioLayer object. The PanoramioLayer renders a layer of geotagged photo icons from Panoramio on the map as a series of large and small photo icons. Let us now have a look at the following code to understand the concept in more detail.



    You can copy the above code in a text file and save it with html extension. Open the file in your browser and you will see a map centred at Pune, India. The output of the code is as ssen in the result section above.

    By default, clicking on a photo icon within a Panoramio layer brings up an info window with a larger photo and more information. You may remove this default behavior by setting the layer's suppressInfoWindows property to true. This is a basic example on Panoramio Layer. More examples coming soon...! Till then, keep mapping!..
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Tuesday, March 22, 2011

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 full-blown bicycling layer.



    The output of the above code will look as seen in the result section above. Dark green routes indicate dedicated bicycle routes. Light green routes indicate streets with dedicated "bike lanes". Dashed routes indicate streets or paths otherwise recommended for bicycle usage.

    If you have any queries or doubts regarding the above code do drop a comment. Till then happy mapping!...:)
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

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 result section above. The map in this example is centred at Los Angeles. Traffic Layer data in not available for India as of now. Hope it will be some day soon...
 
Traffic Color Description:
        If available in your area, real-time traffic conditions will be displayed over the road as color-coded lines. The colors indicate the speed of traffic on the road compared to free-flowing conditions. For highways, the colors roughly equate to:
  • Green: more than 50 mph or 80 kph.
  • Yellow: 25-50 mph or 40-80 kph.
  • Red: less than 25 mph or 40 kph.
  • Red/Black: very slow, stop-and-go traffic.
  • Gray: No data currently available.
          These speeds don't apply to traffic on smaller roads, such as those within cities, which have lower speed limits. For roads smaller than highways, the colors give an indication of the severity of the traffic. Green means that the traffic conditions are good, yellow means fair, and red or red/black means poor traffic conditions.
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Monday, March 21, 2011

Now mosquitoes will be mapped...

         The Indian Council of Medical Research (ICMR) will undertake a mapping of mosquitoes in Orissa, India using a Geographic Information System (GIS). The proposed GIS mapping of vectors is aimed at evolving a common strategy to fight all vector-borne diseases at one go. ICMR aims to complete the exercise before monsoon when mosquito breeding goes up. Once done for Orissa, similar exercises will be undertaken in other states as well. Besides RMRC, Vector Control Research Centre, Puducherry, and National Malaria Research Institute, Delhi, in collaboration with the Orissa state government will be a part of this exercise.

         While different vectors cause dengue, malaria, filaria and chikungunya, separate programmes are undertaken to control these diseases, resulting in duplication of efforts and resources. However, if all vectors of a particular location are known, one common programme can be designed for that area to kill all vectors. The mapping will help gradually shift from disease-specific to location-specific strategy depending on what kind of vectors are present in a particular area.

         After the mapping, the study will also come out with city and district-specific suggestions to control the disease causing vectors.
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Web based GIS for polling booths in West Bengal...

         The election commission of India will install web-based GIS in West Bengal's polling booths to help the State Chief Electoral Officer track them on their web site. The system will provide a map showing the exact spatial location of all 51919 polling booths and nearby landmarks, with their latitudinal and longitudinal coordinates. Boundaries of the parliamentary and assembly constituencies of the booths, along with all the administrative boundaries will also be provided in the GIS-based map.

         The software will give a 360-degree view of the entire area falling within the 200-meter radius of each polling booth, including approach roads and nearby installations. It will show every detail of the polling station, such as the number of voters, number of polling and security personnel deployed, details about the current law and order situation and reports of past violence or disturbance in the area. While the maps will be accessible to all, classified information will be available only to the election commission officials.

         The commission is also trying to put up a picture of each of the polling booths along with the booth details for easy identification. Plans are also on to use the Google API so that the exact geographical positions of the polling booths can be seen directly on a satellite image rather than just a map.
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Thursday, March 10, 2011

GeoRSS Layer...

    It's been long since I last posted an example here...But I am finally posting one again and it is about creating a GeoRSS layer on the google base map, using the Google Maps API.

    The first question will be, "What is GeoRSS?" GeoRSS is nothing but geographically tagged or geographically referenced RSS feeds. RSS feeds having latitude- longitude information of the place of feed. Whether it's pictures from your vacation, favorite places on the globe, or the hiking trails you like to visit, all you have to do is geo-tag them and then load it up. This idea that you can view data from external sources inside Google Maps is really exciting.

    Moving on to the example...There's no great deal about it. Copy and paste the following code in a html file and open it in your default browser. Here follows the code...


    The output of the above code looks as seen in th result section above. The best thing about the GeoRSS layer is that, you will not see the same output (markers) every time...This is because, only the latest feeds are shown on the map. So as the feeds change so do the markers on the map and effectively your output changes.

    If you have any questions regarding this code or any suggestions regarding the blog then feel free to drop your comment here...Please note that the link that has been used in the example code above is not owned by me and was available freely on the net. So any changes happening in the data will not be my responsibility. Till then happy mapping...
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Tuesday, March 8, 2011

Blue census, Water census...

          The Uttar Pradesh State Water and Sanitation Mission (SWSM) will soon be documenting the drinking water resources across six zones of the state. These zones are Allahabad, Ghaziabad, Gorakhpur, Lucknow, Varanasi and Moradabad. The documentation - to be done through Geographical Information System (GIS) and Global Positioning System (GPS) mapping - will take note of ponds (manmade and natural), wells and handpumps. This exercise which is a part of the National Rural Drinking Water Programme (NRDWP) will help the officials to create a proper database of these resources, which will be used for their management.

         Through the mapping, all the details of all the resources will be compiled, complete with their longitude and latitude dimensions. The department plans to start off the exercise by April 1, 2011 and should end by March 31, 2012. The focus will initially be on villages where the drinking water condition is really bad in summer and this data will be mapped within three months. This would help the authorities to finalise plans for providing emergency relief to these villages. After the mapping, the details will be given to the selected civil society organisations in these villages, who will then do a regular monitoring of the water quality.
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Thursday, March 3, 2011

Ahmedabad to have tree census...

         How about keeping a digital watch on the chopping of trees in the narrow lanes of Ahmedabad? Great for sure, would say tree-lovers and environmentalists. And the great idea might soon turn into reality as the Ahmedabad Municipal Corporation (AMC), Gujarat University (GU) and the state forest department have geared up to establish an electronic database after the first ever tree census in Ahmedabad.

         The initial idea is to get a concrete figure on the tree population in Ahmedabad as presently there are only some estimations and random surveys with speculative figures of the number of trees. The proposed tree census is supposed to start from the first week of May this year.

         While the census would be carried out manually, Global Positioning Sysytem (GPS) and Geographic Information System (GIS) would be put in place to get an electronic database of the types of trees and the exact number of trees in the city. At the end of the survey the database would even hold minute details of the tree population in the city.

         The tree census would enable to get reliable scientific documentation of tree species which are rare in the city, define the number of trees per person in the city, a reliable indicator of climate change and C-stock and the greening efforts required in the city.

         The tree census would be done in all the parts of the city covering educational institutions like schools, colleges, universities, residential areas, road-sides, road-dividers, ponds, open spaces, parks among others. The tree census would enable the authorities to get a better estimate of the required green cover. Trees should be viewed as an infrastructure, most needed for proper sustainable development of the city.
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!