Where AM I? An offline google map application.

By | July 28, 2010
Disclaimer:
This article is for educational purpose only, it is purely demonstrating how google map works.
Hi Guys,
If you are reading this article, you should know about google maps. It’s an awesome service, and the API provided can help you to do lots stuff, ie inputting your GPS coordinates and pin point where you are. HOWEVER, google maps only works when you have an internet connection, which is not feasible for most of us to have wireless internet card.
So I started to think, what if I can store google map on to my harddrive??
Then I searched and searched and searched on google… finally I found 2 links that helped me achieve this.
The first link which helped me how to retrieve the map:
The second link which helped me to find out where I am exactly:
Let me briefly put them together
  1. You need to find out the GPS boundaries for your city, left upper bound and bottom right bound.
  2. Use the c# function getTileXY(double lat, double lon, int zoom) provided below to calculate the X,Y tile coordinates to help you “retrieve” the maps from google map. Eg. left upper bound tile is x=10, y=10 and bottom right bound tile is x=100, y=100, then you use a for loop to download the tiles in between those 2 bounds, x=11, y=10……x=99, y=98….
  3. Now, assume you have “retrieved” all the map tiles for your city, use the same c# function getTileXY(double lat, double lon, int zoom) which work out the x,y tile to find out which tile you are currently at.
  4. After finding the tile you are currently at, ie. x=55, y=67 tile, you need to work out the pixel coordinate inside a tile to pin point where you are inside a tile, use C# function getXYPixelFromTile(double lat, double lon, int zoom)

A Map Tile looks like this:

2017-1249-6

OK, thats the theory, you should be able to build up an application hooks up to a GPS device:

GPS

C# Functions:

Category: C#

Leave a Reply

Your email address will not be published. Required fields are marked *