Offline map for iPhone 4

Source: Internet
Author: User

Recently I have created several offline maps for iPhone 4. I would like to sum up my experience:

 

1. Original Map download

Download using Global Map download tool. There are many online tutorials.

 

2. Convert to iPhone format

Use the '-> iPhone' function of gmdl and select firmware2.2 & 3 to generate maptiles. sqlitedb.

 

3. Convert to iPhone 4 format

Convert mapv4v5converter to iphone4 format to generate a new maptiles. sqlitedb.

For iPhone 4 and ios4.2.1, the version information of the generated maptiles. sqlitedb is incorrect (depressing ).

The version table of maptiles. sqlitedb generated by the iphone4 map application is as follows:

$ Sqlite3 maptiles. sqlitedb

 

SQLite version 3.6.23.2
Enter ". Help" for instructions
SQLite> select * from version;
11 | zh_cn
-1, 32519 |
SQLite>

 

The maptiles. sqlitedb generated by mapv4v5converter is as follows:

$ Sqlite3 maptiles. sqlitedb

 

SQLite version 3.6.23.2
Enter ". Help" for instructions
SQLite> select * from version;
10 | zh_cn
0 |
SQLite>

 

The locale, that is, zh_cn, may also be another value. Therefore, you need to change the table to the same as the original one.:

SQLite> Update version set version =-32519 where version = 0;
SQLite> Update version set locale = 'zh _ cn' where version = 10;

SQLite> Update version set version = '11' where version = 10;

 

Sqlite3 can be installed on an iPhone or a PC.

 

4. Initial map point

Use com. Apple. Maps. plist to determine the initial viewpoint. Use the latitude and longitude query tool to determine the map center.

Download com. Apple. Maps. plist from the/var/mobile/library/preferences directory of iPhone 4 and use

Modify the plist file editing tool to the following content (latitude and longpolling are the longitude and latitude of Beijing and should be replaced

Longitude and latitude of the map city center ):

<? XML version = "1.0" encoding = "UTF-8"?>
<! Doctype plist public "-// Apple // DTD plist 1.0 // en" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<Plist version = "1.0">
<Dict>
<Key> lastviewmode </key>
<Integer> 0 </Integer>
<Key> lastviewedlatitude </key>
<True> 39.908711 </real>
<Key> lastviewedlong.pdf </key>
<True> 116.397506 </real>
<Key> lastviewedzoomscale </key>
<Real> 11 </real>
</Dict>
</Plist>

 

5. Map Installation

Only maptiles. sqlitedb and COM. Apple. Maps. plist files related to each map are available:

/Var/mobile/library/caches/maps/maptiles and/var/mobile/library/preferences.

Therefore, you only need to upload the created file to the above path. Note that the permissions for these two files should be 644, and the user/group should be mobile/mobile

(Chmod 644 file; chown Mobile: Mobile file ).

 

6. Multi-map Management

Since the iPhone can only use one map file, it is troublesome to manage multiple offline maps.

Offlinemaps stores the map file in the/var/mobile/Media/maps directory and copies the map to the target directory.

Of course, the most direct idea is to create a symbolic link to the target directory, but the experiment finds it difficult (for unknown reasons ).

However, if you create a directory in the/var/mobile/library/caches/maps/maptiles directory and place the map file,

Then, you can create a symbolic link to the directory. Therefore, you can go to the/var/mobile/library/caches/maps/maptiles directory.

Create different directories, such as Beijing and Harbin, and place maptiles. sqlitedb and COM. Apple. Maps. plist.

To use an offline map, use ifile to create a symbolic link for maptiles. sqlitedb to the/var/mobile/library/caches/maps/maptiles directory,

Copy com. Apple. Maps. plist to the/var/mobile/library/preferences directory.

 

7. Online-Offline Switching

If an offline map is used online, the map application modifies maptiles. sqlitedb,

Generate the Journal File of sqlitedb (unknown reason), resulting in slow response and even crash (shame !).

Therefore, do not use offline maps online. You only need to delete the symbolic link pointing to maptiles. sqlitedb.

In this case, the map application generates a new maptiles. sqlitedb.

 

8. Automation

I don't want to develop an iPhone application. I hope that it is best to implement the above method as an application.

Since offlinemaps is a Python script program, it should be very easy to do this,

I don't understand why do we have to copy maps, so I hope we can make some useful things to benefit the masses.


Note:

1. Map enhancer is hard to use on iPhone 4.

2. iphoneofflinemaps can only be copied (orz). It takes up more than twice as much space as it is.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.