guidebee

June 5, 2007

Google Map Downloader(2)

Filed under: Uncategorized — guidebee @ 3:34 pm
Today, I finished the first version google map downloader .

here is the user manual and some screen clips

Main Screen

The main screen display the world map in small scale, the default zoom level is 16 (the whole world as shown above), the actually Google map’s scale can vary from -2 to 17 ,but this Google map downloader only allow to download from 0 to 17,mainly because zoom 0 is large enough to show all the details.
Click the 4 direction arrow key moves the map, and click the + , – zoom in ,zoom out the map. And when move the mouse over the map, the current latitude/longitude is shown at right top area.(Current location)

Set download area

Before downloading, you need to specify a rectangle area to be downloaded, “Top Left “ gives the top left point longitude/latitude pair, and “Right Bottom” gives the right bottom point’s longitude/latitude pair.
The longitude/latitude pair can be entered manually. Or use the current position , Press “Alt + A” sets the first point, “Alt + Z” gives the second point (right bottom).
Also you need to gives the zoom level ,valid value is from 0 to 17, 0 is the largest scale, 17 is the smallest scale.

Download maps

Press “Start” , the downloader starts to download all the maps in given area. Press “Stop” stops the download.
The download maps is stored in current directory’s maps subdir.

View the downloaded maps

China

If you want to download maps in China, remember to check the China “option”.
Download
http://www.pstreets.com/download/gmap.zip

June 3, 2007

Google Map Downloader(1)

Filed under: Uncategorized — guidebee @ 3:18 pm

Based on what I have found about the Google map, I tried to download the entire Google map from Zoom Level 17 to Zoom Level 9. To my surprised, the total size of these pictures is about 123877653 byte; total number of files is 85191. Rough download time was around 10 hours. The average file size is 1.5K.
The general purpose Google map downloader is still under developing, here’s the screen snapshot. Should be done in weeks if I have enough free time 🙂

June 2, 2007

Map Data Pre-process(5)

Filed under: Uncategorized — guidebee @ 12:29 pm

Mill Cylindrical projection


But with the formula shown above, calculating the x, y pixel based on the Latitude and longitude , the actually result has a big difference with the latitude shown in the Google map.
And with WGS84 the C# code list below
double RefLat=0;
double N0;
double q1,q2,q;
double dLat=srcLatitude;
double dLong=srcLongitude;
double CentralMeridian=0;
double x,y;
N0 = 6378137.0 / Math.Sqrt( 1-Math.Pow(0.081819190843,2)*Math.Pow(Math.Sin(RefLat*Math.PI/180),2) );
q1 = Math.Log( Math.Tan( (180.0/4.0+dLat/2.0)*Math.PI/180.0 ) );
q2 = 0.081819190843/2 * Math.Log( (1+0.081819190843*Math.Sin(dLat*Math.PI/180.0) ) /
(1-0.081819190843*Math.Sin(dLat*Math.PI/180.0) ) );
q = q1 – q2 ;
x = N0 * Math.Cos(RefLat*Math.PI/180.0) * ((dLong-CentralMeridian)/57.29577951) ;
y = N0 * Math.Cos(RefLat*Math.PI/180.0) * q ;

89.9999 (latitude)=88943153.2428999 (meter)
85.0207077431259(latitude)=19955741.4661156(meter)
31.9(latitude)=3727614.05671615(meter)

We know that when zoom level=7 , when latitude = -31.9 ,the y index of the tiles is 608
At first I thought , Google map the latitude range is from -90 to 90. but

3727614.05671615/88943153.2428999=21 . then plus 512 = 533 (far below 608)
I cannot figure out how Google use the map projection algorithm . I am a bit confused.
Then I remembered Google map API provides a API called fromDivPixelToLatLng() ,which computes the geographical coordinates from pixel coordinates in the div that holds the draggable map.
So I wrote a simple JavaScript ,then I found the max latitude Google map uses is 85.0207077431259.
(3727614.05671615/19955741.4661156+1)*512=607.63 (round to 608).

So here comes the final result. Google map uses WGS84 and the
Longitude [-180,180]
Latitude [-85.0207077431259, 85.0207077431259]

Blog at WordPress.com.

Design a site like this with WordPress.com
Get started