Sei sulla pagina 1di 8

How to Use the Offline Google Map API to Load Offline

Google Maps
The detailed information you can visit: www.arceyessoft.com
The Method to Use the Google Map API to Load ffline Google Maps
Step one:
!. "ownload the sample data
#. $ere we ta%e the Maps "ownloader &or Google 'atellite for e(ample to show you
the way to download Google 'atellite Map.
). After install the Maps "ownloader &or Google 'atellite* launch it * as shown +elow.
,ecause we -ust to ma%e demo to show how to use the Google Map offline API to
load Google Maps* therefore we only need to select . /ew 0or%1 region. Then clic% 2
'elect 3egion2 on the tool+ar* and draw the scope* as you can see the following
picture.
"ou+le4clic% the left mouse +utton in the scope you choose* display the /ew Tas%
dialog +o( in which we can select )45 level or any level you want to downloaded. As
it shown in the following picture.
6lic% the 272 +utton to start downloading satellite map data.
After complete e(porting data* select e(port type 2Google Map2* save it to the 2": 8
Test2 directory* as shown +elow.
6lic% the 2utput2 +utton to e(port Google Map* as shown +elow.
Step two:
Map engine deployment
!. "ownload the 2GoogleMapAPI9).rar2 and then e(tract it to the 2": 8 Test2
directory.
#. 3ename the 2/ew 0or% :Google Map Tiles2 which in the 2": 8 Test2 directory as
2data2;
Step three
6opy the code +elow and save it as html files <such as
2=(ample:GoogleMapAPI.html2>* put it to 2": 8 Test 8 GoogleMapAPI9)2 directory.
?@"6T0P= htmlA
?htmlA
?headA
?meta http4eBuivC26ontent4Type2 contentC2te(tDhtmlE charsetCutf4F2 DA
?titleAGoogle Maps Gava'cript API v) =(ample: Image MapTypes?DtitleA
?lin% hrefC2mapfilesDcssDdefault.css2 relC2stylesheet2 typeC2te(tDcss2 DA
?script typeC2te(tD-avascript2 srcC2mapapi.-s2A?DscriptA
?scriptA
function tlen<len* mystr>H
mystr C 'tring<mystr>E
var num C len 4 mystr.lengthE
for <var i C IE i ?C numE iJJ>
H
mystr C 2I2 J mystrE
K
return mystrE
KE
function 6oordMapType<tile'iLe> H
this.tile'iLe C tile'iLeE
K

6oordMapType.prototype.getTile C function<coord* Loom* owner"ocument> H
var div C owner"ocument.create=lement<M"I9M>E
var yma( C ! ?? LoomE
var y C coord.yE
y C tlen<N*y>E
var ( C tlen<N*coord.(>E
Loom C tlen<!*Loom>E
div.inner$TML C y J 2*2 J ( J 2*2 J LoomE
div.style.width C this.tile'iLe.width J Mp(ME
div.style.height C this.tile'iLe.height J Mp(ME
div.style.font'iLe C M!IME
div.style.+order'tyle C MsolidME
div.style.+orderOidth C M!p(ME
div.style.+order6olor C MPAAAAAAME
return divE
KE
function LocalMapType<> HK
LocalMapType.prototype.tile'iLe C new google.maps.'iLe<#NQ* #NQ>E
LocalMapType.prototype.ma(Room C #IE
LocalMapType.prototype.minRoom C !E
LocalMapType.prototype.name C 2Local2E
LocalMapType.prototype.alt C 2Local Map2E
LocalMapType.prototype.getTile C function<coord* Loom* owner"ocument> H
var img C owner"ocument.create=lement<2img2>E
img.style.width C this.tile'iLe.width J 2p(2E
img.style.height C this.tile'iLe.height J 2p(2E

var yma( C ! ?? LoomE
var y C coord.yE
y C tlen<N*y>E
var ( C tlen<N*coord.(>E
Loom C tlen<!*Loom>E
var strU3L C 2..88data88L2 J Loom J 2882 J y J 242 J ( J 2.-pg2E
img.src C strU3LE
return imgE
KE
var localMapType C new LocalMapType<>E
function initialiLe<> H
var myLatlng C new google.maps.LatLng<I* I>E
var myptions C H
center: myLatlng*
Loom: !*
street9iew6ontrol: false*
mapType6ontrolptions: H
mapTypeIds: ST
K
KE

var map C new google.maps.Map<document.get=lement,yId<2map:canvas2>*
myptions>E
DDmap.setMapTypeId<MsatelliteM>E
DDmap.MapTypes.insertAt<I* moonMapType>E
map.mapTypes.set<MlocalM* localMapType>E
map.setMapTypeId<MlocalM>E
map.overlayMapTypes.insertAt<I* new 6oordMapType<new google.maps.'iLe<#NQ*
#NQ>>>E
K

?DscriptA
?DheadA
?+ody onLoadC2initialiLe<>2A
?div idC2map:canvas2 styleC2width: QUIp(E height: UFIp(E2A?DdivA
?D+odyA
?DhtmlA
Then open the 2": 8 Test 8 GoogleMapAPI9) 8 =(ample:GoogleMapAPI.html2 in
your ,rower* if you do it correctly it will display the offline satellite map* as shown
+elow.
The information a+ove is the practical way to use the Google Map API to load offline
Google maps* you can ma%e further development on 2": 8 Test 8 GoogleMapAPI9) 8
=(ample:GoogleMapAPI.html2 file.
0ou can download it for a free trial.

Potrebbero piacerti anche