How to Use the Offline Google Map API to Load Offline Google Maps The Method to Use the Google Map API to Load Offline Google Maps Step one: 1. Download the sample data 2. Here we take the Maps Downloader For Google Satellite for example to show you the way to download Google Satellite Map. 3. After install the Maps Downloader For Google Satellite, launch it , as shown below.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
How to Use the Offline Google Map API to Load Offline
Google Maps
The Method to Use the Google Map API to Load Offline Google MapsStep one:1. Download the sample data2. Here we take the Maps Downloader For Google Satellite for example to show you the way to download Google Satellite Map.3. After install the Maps Downloader For Google Satellite, launch it , as shown below.
Because we just to make demo to show how to use the Google Map offline API to load Google Maps, therefore we only need to select “ New York” region. Then click " Select Region" on the toolbar, and draw the scope, as you can see the following picture.
Double-click the left mouse button in the scope you choose, display the New Task dialog box in which we can select 3-7 level or any level you want to downloaded. As it shown in the following picture.
Click the "OK" button to start downloading satellite map data.After complete exporting data, select export type "Google Map", save it to the "D: \ Test" directory, as shown below.
Click the "Output" button to export Google Map, as shown below.
Step two:Map engine deployment1. Download the "GoogleMapAPIV3.rar" and then extract it to the "D: \ Test" directory.
2. Rename the "New York _Google Map Tiles" which in the "D: \ Test" directory as "data"’
Step threeCopy the code below and save it as html files (such as "Example_GoogleMapAPI.html"), put it to "D: \ Test \ GoogleMapAPIV3" directory.
var ymax = 1 << zoom;var y = coord.y;y = tlen(5,y);var x = tlen(5,coord.x);zoom = tlen(1,zoom);
var strURL = "..\\data\\L" + zoom + "\\" + y + "-" + x + ".jpg";
img.src = strURL;return img;
};
var localMapType = new LocalMapType(); function initialize() { var myLatlng = new google.maps.LatLng(0, 0); var myOptions = { center: myLatlng, zoom: 1, streetViewControl: false, mapTypeControlOptions: { mapTypeIds: [] } }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); //map.setMapTypeId('satellite'); //map.MapTypes.insertAt(0, moonMapType); map.mapTypes.set('local', localMapType); map.setMapTypeId('local'); map.overlayMapTypes.insertAt(0, new CoordMapType(new google.maps.Size(256, 256))); } </script></head><body onLoad="initialize()"> <div id="map_canvas" style="width: 640px; height: 480px;"></div></body></html>Then open the "D: \ Test \ GoogleMapAPIV3 \ Example_GoogleMapAPI.html" in your Brower, if you do it correctly it will display the offline satellite map, as shown below.
The information above is the practical way to use the Google Map API to load offline Google maps, you can make further development on "D: \ Test \ GoogleMapAPIV3 \ Example_GoogleMapAPI.html" file.