Sunday, April 29, 2012

50000 hits and live examples

    Hello to all the blog readers - to the regulars and the first timers. Spatial Unlimited just crossed the 50,000 all time hits milestone and so its time to celebrate and also mark the occasion with something new and interesting.

 

    The new addition to this blog is that, you will now be able to enjoy the codes live on the blog. I am adding some life to the blog by converting all the earlier life-less codes to JsFiddle powered live examples. I have converted a few and am sharing the links here. Please share your feedback and let me know what you think of the new additions. Hope you keep enjoying the blog as much as I enjoy updating it! Cheers!

Links to Live Examples:
1. Simple Google Map
2. Simple Map Marker
3. Multiple Markers
4. KML Layer
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, April 13, 2012

Titanic mapping - 100th aniversary


    When you hear "Titanic", the first thing that comes to your mind is the 1997 classic, Kate Winslet and Leonardo DiCaprio starer, James Cameron directed epic romantic disaster film "Titanic" which after more than 15 years is re-released in 3D. You must be wondering why I am talking about the movie here on this blog. Well, its not about the movie, but about the mapping of the Titanic that interests me!

    April 15, 2012 will mark the 100th anniversary of the sinking of the Titanic in the North Atlantic Ocean. A century ago the Titanic collided with an iceberg in the north Atlantic and sank. Mapping traveler's hometowns, revels the immigrant status of most people traveling third-class, who also suffered the highest fatality rate. ESRI, has created a map story that will help us look at the geography, class and the fate of the passengers aboard the ship 100 years ago. The online map displays the hometowns of all the passengers aboard the Titanic excluding the crew and identifies them by the type of class they were traveling on whether first, second or third.

    The passenger data was mapped from Wikipedia's list of Titanic passengers. Visit Geography, class and fate: Passengers on the Titanic to see this amazing map story. Click on the menu items to see only the places of origins by a specific class and to view a pie chart showing how many passengers survived and died within that class.  Click on a location to see a list of passengers based from that point.  You can delve further into the lives of the Titanic passenger list to see that person’s hometown, boarding location, intended destination, age, class traveled, and whether or not they survived.


    Hope you all love this map story - Geography, Class and fate: Passengers on the Titanic!
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, April 12, 2012

A Giant called Google...



    Wondering what you will be reading in this post today and what is "Google Giant"! Well, I was working on a simple project a couple of months back and that is the time when I was amazed and by the size of data that Google Maps servers might be having! As most of the readers (developers and enthusiast included) would know or might have noticed, Google maps are rendered by stitching small images together. You must have observed this on quite a number of occasions, when you see grey tiles when you have a slow internet connection in particular. It takes time for the images or tiles as we call them to be displayed.

    Let us try and estimate what could be the size of the Google Maps data! Before proceeding, let's make a few assumptions and considerations.
1. Let's consider the Google Street View maps only.
2. The zoom level that is considered for the calculations is 21 - the max zoom level allowed on Google Maps API.
3. All the numbers are just an estimate and not actual values.

    Google maps zoom level goes from 0 to 21, displaying 1 image at zoom level 0 and 4,398,046,511,104 (about 4 trillion i.e. 4x10^12) image or tiles at zoom level 21. 4,398,046,511,104 tiles at zoom level 21 represent the entire world surface which is about 510.072 million sq km (196.940 million sq mi). Lets say, about 70.9% of the world is water and 29.1% is land, which would mean about 3,118,214,976,373 tiles would all be blue in color. About 30% of the land area is under forest cover, which means about 383,949,460,419 tiles would be green in color. The remaining 895,882,074,312 will have multiple colors depending upon what part of the land is part of these tiles. If the numbers have gotten too large, let's tabulate them.

Sr. No. No. of tiles Color of tiles
1 3,118,214,976,373 Blue
2 383,949,460,419 Green
3 895,882,074,312 Multicolored

    Now that we have a clear picture of the number of tiles and the colors they would have, let's try and estimate the size of these tiles. Each tile or image is 256x256 pixels and each blue and green color tile/ image would then be around 4KB each. This means that the total size in KB of all the green and blue colored tiles/ images would be about 14,008,657,747,168KB; that's about 13,046.5TB. This is huge and still there are about 0.8 trillion tiles left whose size needs to be calculated.

    Let us go ahead and do that as well. Since these remaining tiles are multicolored, the size of each tile ranges in between 13 to 17KB. For our calculations, let's assume that the size of each of the multicolored tile is about 15KB. That would mean that the total size of these tiles is about 13,438,231,114,680KB; that's about 12,515TB.

    That means; if my math is not wrong; the size of all the Google Map tiles for Google Map Street View at zoom level 21 alone is about 25,500TB.
 
    This 25K TB space is required to save tiles only for one type of Google Map at the highest zoom. There are tiles at other zoom levels and also tiles of other map types - Satellite Map and the Terrain Map. The labels that appear in the Hybrid map type is also a separate layer on top of the Satellite map. That means about 25K TB more for the satellite map at zoom level 21 and about the same for hybrid map at the same zoom level. Plus about a 15K TB for the labels layer in hybrid map. If the approximation is to believed, Google has around 100 thousand TB space for the maximum zoom level of all the map types.

    Yes, it seems comical to attempt such a calculation where every step of the way requires an approximation. That's why in the end I end up with a such a wide chasm of error. And, of course, this rough analysis does not cover area distortion introduced by mapping the globe's points onto a two dimensional surface. But, there you have it - the story of "Google - A Giant".
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, April 9, 2012

Google Weather Layer - Simple Example

    As promised in the last post, we will be having a look at a very simple example that will help us understand how we can use the weather layer effectively in our Google Map applications using the Google Maps API v3. The weather layer is basically a combination of 2 layers - the Weather Layer and the Clouds Layer. The weather layers displays the weather icons and the temperature corresponding that icon whereas the clouds layers displays the cloud cover across the globe. We can choose to display or hide any of these layers. Let us now dive into a very simple code that will help us understand the basics of the Weather Layer library today.



    The output of the above code will appear as seen in the result section above. You will find a map centered at "India" with both the weather and cloud layers enabled!

    Most part of the above code is similar to most other examples you will find on this site. There are just 2 new and important things in this code. Look out for the variables "weather" and "clouds". The variable weather basically holds a new object of the type weatherLayer and has a property called temperatureUnits. The value of this property can either be in degrees Celsius or Fahrenheit. The clouds basically holds a new object of the type cloudLayer. We can choose not to display either of these layers by commenting out the "setMap(map)" lines from the above code.

    Like rest of the examples seen here, this is another simple, easy-to-understand example code using the Google Maps API v3. If you have any queries regarding the code, please feel free to drop a comment and I will be happy to help you with the code.
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, April 5, 2012

Weather Layer now available with Google Maps API

    Yes! We now have the Google's Weather Layer available to use with the Google Maps API v3. The weather layer was released on Google Maps website in August 2011with cloud imagery from the U.S. Naval Research Lab and weather forecast information from weather.com. Since then developers across the globe have been waiting for this layer to be released for use with the Maps API. You can find about the weather layer on the Google Maps in the post I wrote in August last year.

    This weather layer has now been made available for use with the maps API through the weather library which basically consists of two classes: 'WeatherLayer' and 'CloudLayer'. The 'WeatherLayer' class displays the current weather conditions at various locations, as well as a forecast for the next four days when a user clicks on the icon at that particular location. The units for temperature (degrees Celsius and Fahrenheit) and wind speed (km/hr, miles/hr, m/sec) can also be configured just as it can be done on the Google Maps site. The 'CloudLayer' class displays satellite imagery of the cloud coverage.

    I will soon be putting up a few examples to display how this library can be used with the Google Maps API. Watch this space for some simple and complex examples using the Weather Layer.


    You can access other available sample codes here! Please leave a comment to share your views on the same!
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, April 1, 2012

Google's latest April Fool's Prank

      Google has done it again! Just in time for the April Fool's Day, Google introduced Google Maps Quest, a retro 8-bit version of its mapping tool... which is completely awesome! In the video available below, Google employees introduce the new version for the Nintendo Entertainment System (NES), replete with finicky cartridge and the vintage 8-bit music.



      With this new Google Maps Quest, one can do all the things that can already be done on the regular Google Map. You can search for famous landmarks and sites around the world like the Taj Mahal, Agra, India.


      You can also get detailed directions to avoid dangerous paths, and battle your way through a world of powerful monsters and mystic treasures. You can see the sequence of following images at lat-long 0,0 at incremental zoom levels starting from zoom level 9.








       To use this awesome 8-bit (from your computer of course), head over to Google Maps and simply click on the Quest box in the top right corner. You would then be whisked away to the 8-bit land of fun! Be sure to try out the Street View in the 8-bit land.

       This NES cartridge will be the first in 18 years to be released (if it really would be!) and also there is already a version in development for the Game Boy. Does Google have anything else up its sleeve this April's Fool Day!?

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!