Tuesday, November 30, 2010

Drive along - Cool coding

         This is something that will demonstrate to you the power of mapping! This is a Google Maps API v2 example, but just copy and paste the code in an html file and you will see something very cool! This will prove that mapping is real fun!

         Let's have a look at the code first. Copy this code in your html file. Don't worry about the length of the code and the post in general. Just execute the code and you will surely enjoy what you see!

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>
Drive Along
</title>

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAu3HXU_hLdVPTFGqLed_FCxT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQbblEPYBGNoRsuuSU9aBfSq4VAZA" type="text/javascript">
</script>

<script src="http://econym.org.uk/gmap/epoly.js" type="text/javascript">
</script>

</head>

<body onunload="GUnload()">

<div id="controls">
<form onsubmit="start();return false" action="#">
Enter start and end addresses.<br />
<input type="text" size="80" maxlength="200" id="startpoint" value=" " />
<br />
<input type="text" size="80" maxlength="200" id="endpoint" value=" " />
<br />
<input type="submit" value="Start"  />
</form>
</div>

<div id="map" style="width: 700px; height: 500px">
</div>
<div id="step">&nbsp;
</div>
<div id="distance">Miles: 0.00
</div>

<script type="text/javascript">
if (GBrowserIsCompatible())
{
    var map = new GMap2(document.getElementById("map"));
          map.addControl(new GMapTypeControl());
          map.setCenter(new GLatLng(0,0),2);
          var dirn = new GDirections();
          var step = 5; // metres
          var tick = 100; // milliseconds
          var poly;
          var eol;
          var car = new GIcon();
        car.image="http://www.freeiconsweb.com/Freeicons/Car_icon/Dodge%20Viper%20SRT-10.png"
        car.iconSize=new GSize(28,28);
        car.iconAnchor=new GPoint(16,9);
          var marker;
          var k=0;
          var stepnum=0;
          var speed = "";  

          function animate(d)
    {
            if (d>eol)
        {
                  document.getElementById("step").innerHTML = "<b>Trip completed<\/b>";
                  document.getElementById("distance").innerHTML =  "Miles: "+(d/1609.344).toFixed(2);
                  return;
            }
            var p = poly.GetPointAtDistance(d);
            if (k++>=180/step)
        {
                  map.panTo(p);
                  k=0;
            }
            marker.setPoint(p);
            document.getElementById("distance").innerHTML =  "Miles: "+(d/1609.344).toFixed(2)+speed;
            if (stepnum+1 < dirn.getRoute(0).getNumSteps())
        {
                  if (dirn.getRoute(0).getStep(stepnum).getPolylineIndex() < poly.GetIndexAtDistance(d))
            {
                        stepnum++;
                        var steptext = dirn.getRoute(0).getStep(stepnum).getDescriptionHtml();
                        document.getElementById("step").innerHTML = "<b>Next:<\/b> "+steptext;
                        var stepdist = dirn.getRoute(0).getStep(stepnum-1).getDistance().meters;
                        var steptime = dirn.getRoute(0).getStep(stepnum-1).getDuration().seconds;
                        var stepspeed = ((stepdist/steptime) * 2.24).toFixed(0);
                        step = stepspeed/2.5;
                        speed = "<br>Current speed: " + stepspeed +" mph";
                  }
            }
        else
        {
                  if (dirn.getRoute(0).getStep(stepnum).getPolylineIndex() < poly.GetIndexAtDistance(d))
            {
                        document.getElementById("step").innerHTML = "<b>Next: Arrive at your destination<\/b>";
                  }
            }
            setTimeout("animate("+(d+step)+")", tick);
          }

    GEvent.addListener(dirn,"load", function()
    {
        document.getElementById("controls").style.display="none";
            poly=dirn.getPolyline();
            eol=poly.Distance();
            map.setCenter(poly.getVertex(0),17);
            map.addOverlay(new GMarker(poly.getVertex(0),G_START_ICON));
            map.addOverlay(new GMarker(poly.getVertex(poly.getVertexCount()-1),G_END_ICON));
            marker = new GMarker(poly.getVertex(0),{icon:car});
            map.addOverlay(marker);
            var steptext = dirn.getRoute(0).getStep(stepnum).getDescriptionHtml();
            document.getElementById("step").innerHTML = steptext;
            setTimeout("animate(0)",2000);  // Allow time for the initial map display
          });

          GEvent.addListener(dirn,"error", function()
    {
            alert("Location(s) not recognised. Code: "+dirn.getStatus().code);
          });

          function start()
    {
            var startpoint = document.getElementById("startpoint").value;
            var endpoint = document.getElementById("endpoint").value;
            dirn.loadFromWaypoints([startpoint,endpoint],{getPolyline:true,getSteps:true});
          }

}
</script>
</body>
</html>


         Please execute the above code and please drop in your comments about what you think about it. You can also drop me a mail about your feedbacks about this code or the blog in general!
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!

GIS as a vocational elective from June 2011

            As 13 schools affiliated to the Central Board of Secondary Education (CBSE) across India are set to introduce a course on ‘geospatial practices’, a vocational elective for Std XI and XII from 2011, principals and teachers will be trained by an industry partner on ways to implement the programme, next month in Mumbai. The course will be expanded to other schools later.

            Among the 13 schools, RN Podar School in Santa Cruz will be the first school in Mumbai that will introduce this course which focuses on various components of geographic information system/geospatial information systems (GIS) and remote sensing.

            GIS is an emerging field and there is a lot of demand for candidates who are trained in GIS applications and technology today. It has a lot of relevance and so far no school has been providing education in this field. The subject is inter-disciplinary and covers various areas like geography, physics and mathematics, to name a few.

            Rolta India will conduct a workshop in December to train the school teachers and principals from across the country who are offering this course, which will be formally launched in June 2011. Rolta India has developed the curriculum and will also help schools to implement it.

            The workshop will orient teachers towards the course content and ways to approach it. Further, since Rolta India is giving some software to the schools, it will also train teachers on ways to use it. It is good to see that students will be introduced to GIS as a subject so early in their educational phase!
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, November 29, 2010

National Symposium on Remote Sensing and Geoinformatics in Infrastructure Development and Management

            With the focus of the nation shifting towards infrastructure development, through national programs like JNRUM, IRDP, and the participation of private players in infrastructure development, it is projected that annual investments to the tune of Rs. 1,000 Billion will be made in the country across the next 5-7 years. The efficacy of Geoinformatics and Remote Sensing in Infrastructure planning, development and management is well recognized and promoted by the Department of Space and other governmental agencies. In this context, the National Symposium and ISRS Annual Convention is organized on the topic "GIS AND REMOTE SENSING IN INFRASTRUCTURE DEVELOPMENT" from the 29th of November, 2010 to 4th December, 2010.

           The Symposium will expose the frontline developments in remote sensing and Geoinformatics to the infrastructural developers, enabling the latter to appreciate the cost-saving and accuracy enabled by the technology. It is expected that the Symposium will provide a forum for a direct interaction between the space scientists and Geoinformatics technologists on one side and infrastructure managers and administrators on the other.

           The Indian Society of Remote Sensing, Pune Chapter is hosting the ISRS Annual Convention for the second time after 1996.The Symposium venue is located at the hill station of Lonavala, known as the "Jewel of the Sahyadris" is famed for the scenic landscape, milky waterfalls, lush greenery and pleasant cool winds on the slopes of Sahyadri mountains, straddling the Mumbai-Pune highway; about 50km west of Pune. Various educational institutions, research and scientific organizations from government as well as private sector, namely, Sinhgad Educational Institutes, University of Pune - STP, C-DAC, CWPRS, NWA, Symbiosis institute of Geomatics and Kalyani group of companies are combinedly hosting the program.

           The theme of this symposium is the role of Geoinformatics and Remote sensing in Infrastructure development. The role of Geospatial technology in disaster management, natural resource management, environment and forest, archeology, etc. will also be discussed!

            For more details about the symposium please visit the ISRS Pune Chapter's website. It is really such a great thing that Pune is hosting such a huge Geoinformatics event!
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!

Saturday, November 27, 2010

What is GPS?

            Having seen what GIS is, we will now have a look at what GPS or the Global Positioning System is! Wikipedia's following GPS definition says it all. "The Global Positioning System (GPS) is a space-based global navigation satellite system (GNSS) that provides reliable location and time information in all weather and at all times and anywhere on or near the Earth when and where there is an unobstructed line of sight to four or more GPS satellites."

           The Global Positioning System (GPS) is a satellite-based navigation system made up of a network of 24 satellites placed into orbit by the U.S. Department of Defense. The 24 satellites are orbiting the earth about 12,000 miles above us. They are constantly moving, making two complete orbits in less than 24 hours. These satellites are travelling at speeds of roughly 7,000 miles an hour.

          GPS satellites are powered by solar energy. They have backup batteries onboard to keep them running in the event of a solar eclipse, when there's no solar power. Small rocket boosters on each satellite keep them flying in the correct path.

          Here are some other interesting facts about the GPS satellites (also called NAVSTAR, the official U.S. Department of Defense name for GPS):
  • The first GPS satellite was launched in 1978.
  • A full constellation of 24 satellites was achieved in 1994.
  • Each satellite is built to last about 10 years. Replacements are constantly being built and launched into orbit.
  • A GPS satellite weighs approximately 2,000 pounds and is about 17 feet across with the solar panels extended.
  • Transmitter power is only 50 watts or less.



            GPS satellites circle the earth twice a day in a very precise orbit and transmit signal information to earth. GPS receivers take this information and use triangulation to calculate the user's exact location. Essentially, the GPS receiver compares the time a signal was transmitted by a satellite with the time it was received. The time difference tells the GPS receiver how far away the satellite is. Now, with distance measurements from a few more satellites, the receiver can determine the user's position and display it on the unit's electronic map.

            A GPS receiver must be locked on to the signal of at least three satellites to calculate a 2D position (latitude and longitude) and track movement. With four or more satellites in view, the receiver can determine the user's 3D position (latitude, longitude and altitude). Once the user's position has been determined, the GPS unit can calculate other information, such as speed, bearing, track, trip distance, distance to destination, sunrise and sunset time and more.



             Today's GPS receivers are extremely accurate. Today GPS receivers are embedded in a large number of phones. Day-by-day, knowingly or un-knowingly the common man is getting more and more exposure to GIS and GPS technology based systems. Cheers to Geo!...
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, November 25, 2010

Fedora Geo Spin

         It's here! An GIS oriented Operating System!...Currently under development with a target release as Fedora 15, Fedora Geo Spin is a collection of mapping tools that run on Fedora. This includes tools for map making, integration into OpenStreetMap, and components that can be run on a GPS enabled device.

         This spin will include map making tools that integrate with OpenStreetMap. This will enable map makers to use Fedora as a platform for cartography.The end goal is an ISO and kickstart that can be depolyed to work with most cartography setups.

         Integration with developer tools for developing other programs that work with GPS devices. This may lead to a developer subspin that integrates development libraries and tools including for GPS devices. This probably includes a group in comps for handling Geo related libraries and the development counterparts.

         This Geo spin can be integrated with MIDs and other devices that can be enabled with a GPS, to cater to hobbyists such as geocachers, as well as providing a fully open source GPS navigation solution.

         You can have a look at the actual contents of the spin with details about the packages and stuff at the Fedora wiki. Such an initiative from Fedora clearly goes to show that GIS is evolving day by day and there will be a day when GIS will be "the" domain to be in!
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, November 23, 2010

What is GIS?

          Once I started writing this blog, I received a number of feedbacks from readers asking me to write something about what exactly GIS is. So here is some information, that will give you an idea about "What is GIS?"

          A geographic information system (GIS) integrates hardware, software, and data for capturing, managing, analyzing, and displaying all forms of geographically referenced information. GIS allows us to view, understand, question, interpret, and visualize data in many ways that reveal relationships, patterns, and trends in the form of maps, globes, reports, and charts.
 
          A GIS helps you answer questions and solve problems by looking at your data in a way that is quickly understood and easily shared. GIS technology can be integrated into any enterprise information system framework.

          People use GIS to map locate where things are and let you find places that have the feature that you are looking for, and to see where to take action. A simple example of this is Geocaching. People map quantities, like where the most and least are, to find places that meet their criteria and take action, or to see the relationships between places. This gives an additional level of information beyond simply mapping the locations of features.

          While you can see concentrations by simply mapping the locations of features, in areas with many features it may be difficult to see which areas have a higher concentration than others. A density map lets you measure the number of features using a uniform areal unit, such as acres or square miles, so you can clearly see the distribution. Mapping density is especially useful when mapping areas, such as census tracts or counties, which vary greatly in size. On maps showing the number of people per census tract, the larger tracts might have more people than smaller ones. But some smaller tracts might have more people per square mile—a higher density.

         GIS is also used to monitor what's happening and to take specific action by mapping what's inside a specific area. For example, a district attorney would monitor drug-related arrests to find out if an arrest is within 1,000 feet of a school--if so, stiffer penalties apply.

         GIS can also be used to locate what's nearby a specific location. Map change is used to anticipate future needs. For example, a police chief might study how crime patterns change from month to month to help decide where officers should be assigned.

         This article must have given you a general idea of "What is GIS?" Do drop in your comments here or send me your feedbacks at my mail address!
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, November 22, 2010

Tripura to use satellites to track terrorrists

          Tripura will soon use satellites to track terrorists in the state, director general of police K. Saleem Ali said on Sunday the 14th of November, 2010 adding that the state's three-decade old militancy will be "flushed out within the next few months". Tripura would be the third state in India, after Jammu and Kashmir and Jharkhand, to introduce the Geo Satellite Imagery Systems (GSIS) for curbing militancy.

          The satellite image would be as clear as if taken from 10 feet above the ground. All district police chiefs would operate this new system to locate the activities of the separatist outfits. All the police stations of the state are being connected electronically for better coordination. In the first phase 22 out of the 66 police stations would be linked!

          A new method to register a FIR through SMS will also be introduced and would commence from January next year with the help of the National Informatic Center.

Source: Hindustan Times
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!

Form info window

         Today we will look at a Google Maps API v3 example to add a form in the information bubble! This is usually required when we wish to accept some data/information from the user! This data can be saved to a server in the form of an XML file or a database! The information can then be retrieved back at a later stage, when necessary!

         In this example we will only look at form in the information bubble! The connectivity part with the server will be discussed in another post! So, today's code snippet is as seen below!

<html>
<head>
<title>
Google Maps API v3 - Adding marker and info window on Click and creating a form in the infowindow with the lat-lng information in it.
</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var map;    //When using event as a parameter to a function declare map, strictly as a global variable
function initialize()
{
    var myLatlng = new google.maps.LatLng(28.635157,77.22496);
      map = new google.maps.Map(document.getElementById("map_canvas"),
    {
        zoom: 14,
        center: myLatlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    });

    google.maps.event.addListener(map, 'click', function(event)
    {
        placeMarker(event.latLng);
    });
}
 
function placeMarker(location)
{
    var marker = new google.maps.Marker(
    {
        position: location,
        map: map
    });

    var coords= location.lat().toFixed(6) + ',' + location.lng().toFixed(6);

    var html = "<table>" +
                 "<tr><td>Name:</td> <td><input type='text' id='name'/> </td> </tr>" +
        "<tr><td>Location:</td> <td><input type='text' value = " + coords +" id='loc'></td> </tr>" +
                 "<tr><td>Cache Object Taken:</td> <td><input type='text' id='ctake'/></td> </tr>" +
                 "<tr><td>Cache Object Placed:</td> <td><input type='text' id='cput'/></td> </tr>" +
                 "<tr><td></td><td><input type='button' value='Save' onclick='saveData()'/></td></tr>";

    var infowindow = new google.maps.InfoWindow(
    {
        content: html
    });

    google.maps.event.addListener(marker, 'click', function()
    {
        infowindow.open(map,marker);
    });
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width: 100%; height: 100%"></div>
</body>
</html>

         The output of the above code will look as seen below!



           If you have any queries regarding the above code feel free to comment here or drop me a mail. If there are any recommendations regarding content of posts, then please mail me your wish list!
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!

Sunday, November 21, 2010

Static Info window only...

           In our last Google Maps API v3 example we saw how info windows appeared on user click. We saw why such a thing is necessary and the benefits of that! Today we will look at a very simple example, where in we will place a single marker on the map! Something like a simple marker example in this post!

          Our today's code is below!

<html>
<head>
<title>
Google Maps API v3 - Simple info window only example
</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
var map;
function click_window()
{
             map = new google.maps.Map(document.getElementById("map"),
             {
                              zoom: 5,
                              center: new google.maps.LatLng(22.7964,79.5410),
                              mapTypeId: google.maps.MapTypeID.ROADMAP
             });

             var html = "This is a single info window!";

             var infowindow = new google.maps.InfoWindow(
             {
                              content: html,
                              position: new google.maps.LatLng(22.7964,79.5410)
             });

             infowindow.open(map);
}
</script>
</head>
<body onload="click_window()" onload="GUnload()">
<div id="map" style="width:100%; height: 100%">
</div>
</body>
</html>


            Copy and try out the code for yourself! If you have any queries regarding the code comment on the post or feel free to drop me a mail.
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!

Saturday, November 20, 2010

Jugnu: India's first Nano Satellite

          IIT-Kanpur with its nano satellite 'Jugnu' has set new highs in the field of space research. A team of students, working under Dr NS Vyas (the visionary man behind the making of the nano-satellite) and other faculty members of the institute, have successfully made the country's first nano-satellite to be developed for the first time by any educational institute.

          The development of the Jugnu started in the year 2008 with a team of 3 students. With time, the team has grown to the size of more than 50 students ranging from 1st year undergraduates to final year postgraduates and 14 professors from different disciplines to complete this challenging mission.
           The satellite has been handed over to two ISRO scientists, DVA Raghav Murthy (Project Director, Small Satellite Projects) and Dr SK Shiv Kumar (Director, ISRO satellite tracking centre), by President Pratibha Patil on March 6, 2010. View the pictures of the ceremony at IIT Kanpur's photo gallery.

          Golden Jubilee year of IIT Kanpur(Aug 2009- Dec 2010) will witness the launch of Jugnu from Satish Dhawan Space Centre (also known as SHAR, located in Sriharikota, Andhra Pradesh) by ISRO’s Polar Satellite Launch Vehicle. Jugnu will be able to withstand the harshness of space environment for its estimated life span of 1 year.
             
          Weighing less than three kg and with most functionalities of a normal satellite on a small platform, the payload of the satellite will include an indigenously designed camera for near remote sensing and a GPS receiver. 'Jugnu' will transmit blinking signal at all times, all over the Earth. It will revolve around the Earth 15 times a day in polar orbit and will be visible over Kanpur for three to four times for a total of 20 minutes. After its launch, Jugnu will be continuously monitored and controlled by Ground Station located on the IIT Kanpur campus.
          The main objectives behind making a nano satellite were to serve the following applications:
1. Micro Imaging System
2. GPS receiver for locating the position of satellite in the orbit
3. MEMS based IMU (Inertial Measurement Unit)
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!

Friday, November 19, 2010

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.
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, November 18, 2010

Only information bubbles...

         After displaying markers and markers with info windows, we will now display only info windows on the map. So our aim becomes, placing an info window on a google map when a user clicks on the map.

         Now, the first question that will pop up in your mind is why do we need such a thing? To answer this question let us consider a simple example. Consider that, when an user clicks on a map, a marker appears with an info window and you want the user to enter some data in a form in the info window and save that data. Now, if the user enters inconsistent data, there would be marker on the map, having no valid information! The marker would then be rendered useless, with no information! Something like a dangling pointer!

          Now, if you haven't understood a word of this; don't worry. You will soon understand the importance of this example! So, without any further discussions, let's have a look at the code!

          Here goes the code...

<html>
<head>
<title>
Google Maps API v3 - Simple Info window example
</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
var map;
function click_window()
{
             map = new google.maps.Map(document.getElementById("map"),
             {
                         zoom: 5,
                         center: new google.maps.LatLng(22.7964,79.5410),
                         mapTypeId: google.maps.MapTypeId.ROADMAP
             });

             var html = "This is an Info window without a marker.";

             var infowindow = new google.maps.InfoWindow(
             {
                         content: html
             });

             google.maps.event.addListener(map, 'click', function(event)
             {
                         infowindow.setPosition(event.latLng);
                         infowindow.open(map);
              });
}
</script>
</head>
<body onload="click_window()" onunload="GUnload()">
<div id="map" style="width: 100%; height: 100%">
</div>
</body>
</html>


           Copy and paste the above code in an html file and see the map in action! The output will look as seen in the picture below.

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, November 17, 2010

Code for fun..!

         Just wrote a small 3 lines shell script which is capable of searching any random place on Google Map. Try it on your linux boxes! For those who prefer windows, I am sorry to say that this code will not run on your machines. I work on linux system and so I am using some linux specific commands in the script!

         So here goes the shell script!

while [ $? == 0 ]
do
    zenity --info --text="Do not use spaces between multiple words. Instead use the + sign. For example 'new+delhi and not new delhi'"

    search=`zenity --title "Google Maps Location Search" --entry --text "Search: "`

    if [ $search ==  ]
    then

        zenity --question --text="Do you wish to search another location?"

    else

        firefox http://maps.google.com/maps?q=$search

        zenity --question --text="Do you wish to search another location?"
    fi

done


        See the results for yourself! It's simple and easy. Shell scripting and GIS together is so much fun!
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, November 16, 2010

A marker with an information window

         Following the sequence, I should be discussing a marker based example! Markers loading from an XML file. But, we will disrupt the sequence for the sole reason that I don't want to discuss comparatively tough examples as of now! So, we will jump on to a simple example to display an information window or the info window bubble as it is popularly known; along with a marker!

         Let's have a look at the following code. This is a simple code which will place a marker at "India" with an information window attached to it which appears only when the marker is clicked! The code goes as below:

<html>
<head>
<title>
Google Maps JavaScript API v3 Example: Simple  Infowindow
</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
function initialize()
{
    var myLatlng = new google.maps.LatLng(22.7964,79.5410);

    var map = new google.maps.Map(document.getElementById("map"),
    {
        zoom: 5,
        center: myLatlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP

    });

        var contentString = '<b>India</b><br>'+
            '<a href="https://sites.google.com/site/shreerangmohanpatwardhan/">Home</a>';
       
        var infowindow = new google.maps.InfoWindow(
    {
            content: contentString
        });

        var marker = new google.maps.Marker(
    {
            position: myLatlng,
            map: map,
            title: 'India'
    });

        google.maps.event.addListener(marker, 'click', function()
    {
              infowindow.open(map,marker);
        });
}
</script>
</head>
<body onload="initialize()">
<div id="map" style="width: 500px; height: 300px"></div>
</body>
</html>

         Again, there is nothing very surprising out here. The contents of the information window could be anything from simple text, hyper-links to a complete form. Here, you can see that I have displayed a string and a hyper-link which points to my website. You can see the output in the following image.

         You can copy and paste this code and see the map in action! If you have any queries regarding the code, feel free to drop me a mail.



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, November 15, 2010

GIS India News Titbits

         Treading on the foot steps of Gujarat for improvement in governance, the Himachal Pradesh government on Wednesday, 10th November 2010, announced to set up geo-informatics centre for planning with help of the latest digital techniques under supervision of department of science, technology and environment.

         Chief Minister Prem Kumar Dhumal said the centre would be set up on the lines of Bhaskaracharya Institute of Space Applications and Geo-Informatics (BIGSAC), Gandhinagar, Gujarat, and would be named as Aryabhatta Geo-Informatics and Space Applications Centre (AGiSAC).

         Departments that are directly linked with common man including Revenue, Forest, Education, Health, Agriculture, Horticulture, Panchayati Raj and Rural Development would be the first ones to be taken up for planning under the project by digitisation of their record. This would make the working transparent and by making information available to the people on internet.

            State has already set up State Resource Information Centre that uses space technology for formulation of development plans and their evaluation and monitoring. Dhumal said AGiSAC would function as nodal agency for development and planning through Geo-Informatics and Space Technology. The project would be set up with the technical support of Government of Gujarat.


          Apart from the above news there was another interesting news last month. "Indian Railways to install GPS". According to railway minister Mamta Banerjee, GPS technology will be installed on trains in India in the next two years to avoid accidents. The project, Satellite Imaging for Rail Navigation (Simran), uses satellite imaging software along with the  GPS and was developed as part of the Railway Safety Technology Mission to provide correct  train information to passengers. Field trial was conducted in several trains, including Rajdhani Express (Mumbai, Howrah and Patna) and Shatabdi Express (Bhopal, Amritsar and Lucknow).

         After reading these news, I was inclined to believe that the current scenario of GIS is definitely improving! Hope to find many more such news on a regular basis!

Source for the first news: Indian Express
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!

Sunday, November 14, 2010

Multiple markers...

            It rarely happens that there is just one point of interest or just one location that you would like to mark! Generally there is a bunch of markers that appear on the map! Specifically, you want a list of latitude and longitude pairs representing the points of the markers you'll plot.

            To store the list of points, you can combine the power of Javascript's array and object constructs. An array stores a list of numbered entities. To access the elements of the array, you must use their numeric indices. So array[0] will point to the first element in the array while array[n] will point to the nth element in the array.

            I will use the following piece of Javascript code to demonstrate how multiple markers can be made to appear on a map using the array structure and the for loop for iteration.



            Nothing here should be much of a surprise! You can see that the google.maps.Marker function is called for each of the markers, so you can see two markers at two different locations on the map. The result above displays the output that is generated. Feel free to add your own locations and more number of markers on the map! Keep following for more examples and more information on GIS! Till next post, 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!

Saturday, November 13, 2010

Celabrate GIS Day!

         

         The countdown has begun...Only 4 days to go! On the 17th of November, 2010, the world will celebrate "GIS Day". GIS day is held each year in the third week of November, on the Wednesday during the Geography Awareness Week, a geographic literacy initiative sponsored by the National Geographic Society.
        
         GIS Day is playing a powerful role in creating geographic awareness throughout our world. GIS Day provides an international forum for users of geographic information systems (GIS) technology to demonstrate real-world applications that are making a difference in our society.

         More than 80 countries will participate in holding local events such as corporate open houses, hands-on workshops, community expos, school assemblies, and more. Any organisation that uses GIS can participate in this global event.

         Large or small, there are many ways you can participate. From showing a few co-workers what GIS does for your organisation to citywide school presentations, everyone can host a GIS Day event. You can register your event with the GIS Day organisers. You can find more information about the events happening in India on GIS Day here. You can follow the happenings of GIS Day on Facebook as well. Search for "GIS Day". There is lot more on their website.

         Having said all this, it's sad that Pune does not have any registered GIS Day event! I just hope somebody reads this blog and arranges an open-to-all GIS Day event. Wish you all a happy GIS Day in advance!
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!

A simple marker example

            Once you have set up your map as seen in the earlier post you can now place a marker at your point of interest on the map. A marker is a symbol that is used to point something interesting or important on the map! A marker can be overlayed on a map statically, dynamically i.e. when a user clicks on a map, a marker appears on the map. Markers can also be loaded from an XML file, a plain text file and also a CSV file. We will be seeing an example of each in the subsequent posts.

            Later on we will also see how to add an information window to the markers on the map! But that will be at a later stage. Let us have a look at the following code first which will add a marker at the Rajya Sabha, New Delhi.


           And here you are...You have placed a marker at your point of interest. The output will look as seen in the result section above. Feel free to change the point of interest and see a marker at a location of your choice. 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!

Thursday, November 11, 2010

Geocaching - The world's largest treasure hunting game!

         Geocaching is a high-tech treasure hunting game played throughout the world by adventure seekers equipped with GPS devices. The basic idea is to locate hidden containers, called geocaches, outdoors and then share your experiences online. Geocaching is enjoyed by people from all age groups, with a strong sense of community and support for the environment. The following video has been taken from "Geocaching - The official global GPS Cache Hunt Site". This site will give you a brief idea of what Geocaching exactly is!


video

          On May 2, 2000, at approximately midnight, eastern savings time, the great blue switch* controlling selective availability was pressed. Twenty-four satellites around the globe processed their new orders, and instantly the accuracy of GPS technology improved tenfold. Tens of thousands of GPS receivers around the world had an instant upgrade.

           The announcement a day before came as a welcome surprise to everyone who worked with GPS technology. The government had planned to remove selective availability - but had until 2006 to do so. Now, said the White House, anyone could "precisely pinpoint their location or the location of items (such as game) left behind for later recovery." How right they were.

           On May 3, one such enthusiast, Dave Ulmer, a computer consultant, wanted to test the accuracy by hiding a navigational target in the woods. He called the idea the "Great American GPS Stash Hunt" and posted it in an internet GPS users' group. The idea was simple: Hide a container out in the woods and note the coordinates with a GPS unit.

           The finder would then have to locate the container with only the use of his or her GPS receiver. The rules for the finder were simple: "Take some stuff, leave some stuff."

           On May 3rd he placed his own container, a black bucket, in the woods near Beavercreek, Oregon, near Portland. Along with a logbook and pencil, he left various prize items including videos, books, software, and a slingshot. He shared the waypoint of his "stash" with the online community on sci.geo.satellite-nav:
N 45° 17.460 W 122° 24.800

           Within three days, two different readers read about his stash on the Internet, used their own GPS receivers to find the container, and shared their experiences online. Throughout the next week, others excited by the prospect of hiding and finding stashes began hiding their own containers and posting coordinates. Like many new and innovative ideas on the Internet, the concept spread quickly - but this one required leaving your computer to participate.
Within the first month, Mike Teague, the first person to find Ulmer's stash, began gathering the online posts of coordinates around the world and documenting them on his personal home page. The "GPS Stash Hunt" mailing list was created to discuss the emerging activity. Names were even tossed about to replace the name "stash" due to the negative connotations of that name. One such name was "geocaching."

            You can subscribe to Geocaching.com membership which is free and requires only a valid email address and your name to create an account. Once you are a member, you have to choose any geocache from the available list, enter its GPS co-ordinates into your GPS device and go on the treasure hunt! Become a member of the largest treasure hunting game in the world!
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, November 10, 2010

Simple Map using Google Maps API v3

       Let us begin with our first example using Google Maps API v3. Even before a marker - the most basic element of a map, appears, the map should be seen on the screen. Let us have a look at the following javascript code first. We will then have a look at the elements in the code.

            Ta-da a map in action! This map is centred at the Sansad Bhavan, New Delhi, India.
In the above code the head of the document contains a critical script element. Its src attribute points to the location of the API on Google's server. In API v3 there is no need to obtain a key for the API. The remaining is simple Javascript.

          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, November 9, 2010

My first blog!

          "Why is it that there are no Goolge Maps API examples which show India specific data?"...This question kept bothering me all through my learning phase. I always thought why aren't there any examples that use a map which shows Indian locations.

Anybody who is new to Google Maps API application development would love to see a location that he knows of on the map! This is what I longed for all the way through and now have decided to put up simple examples and other supporting data for building customised simple Google Maps and all will show locations in India!

When starting something new, if one finds something familiar out there, then it gives a feeling of comfort! And this is what I will try to provide to all those out there who are facing a similar problem that I faced!

I am not an expert at Google Maps API, I am learning too...But, I will like to help out people along the way! So, all comments from the novice to the professionals are welcome!

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!