In mobile device development, because mobile networks are used and traffic issues need to be considered, it is a good solution to Use offline maps in map applications. Several necessary conditions for developing the offline map function.
1. Image Source acquisition
Most of the images shown in the map are images. offline stores these images to the device, finds an algorithm, and loads the images. Image loading algorithms are tile algorithms.
Extended class. As mentioned above, Arcgis and Mapquest can be expanded.
The image source Acquisition Tool, mobile atlas creator, is an absolutely powerful tool that can be used to obtain image sources from different map servers, such as google and bingmap. Http://bbs.hiapk.com/thread-343851-1-1.html this post is about how to use, I then attached the tool, can run directly. There are many ways to save the image source here. I chose sqlite here, so that the image source is saved to the database. How does it become an image? I wrote a python script, it can be used to convert to an image. I will not go into details here.
2. Expand the map api. I will only post it here.
The principle is simple: Read the image from the app directory and display it.
Package com. google
{
Import com. dingli. model. ModelLocator;
Import flash.net. URLRequest;
/**
* Google offline map layer
*/
Public class GoogleOfflineLayer extends GoogleMayLayer
{
Private var dir: String;
Public function GoogleOfflineLayer ()
{
Super ();
Dir = "";
}
/**
* Construct the url of the offline Image
* @ Param level, Layer
* @ Param row, row
* @ Param col, column
* @ Return the url of the image
*
* The level is 17-level.
* Returns the map address and image address.
* Map address + row + "F" + col + "F" +level.png
*/
Override protected function getTileURL (level: Number, row: Number, col: Number): URLRequest
{
Var retUrl: URLRequest = new URLRequest ();
Var googleLevel: Number = 17-level;
Var url: String = col. toString () + "F" + row. toString () + "F" + googleLevel. toString () + ". png ";
Url = dir + "/" + url;
RetUrl. url = url;
// Debug
// RetUrl. url = "assets/ditu/2.png ";
Trace ("GoogleOfflineLayer. as line 46:" + url );
Return retUrl;
}
}
}
3. upload images to the device.
Ifiles or 91 assistant can be used to directly upload directories to devices. The premise is that the device must be jailbroken.
Offline map tool./Files/csharponworking/mobileatlascreator17sqlitegeographic chart .rar