Mbtiles is a specification developed by MapBox that stores tile map data in a SQLite database and can be quickly used, managed, and shared. This specification is formulated by Mapbox, see http://mapbox.com/mbtiles-spec/.
Supermap Iserver to meet the needs of its own applications, not only support the generation and use of tile map data that satisfies the Mbtiles specification, but also expands the content in mbtiles based on the original specification. The expanded. mbtiles file supports any coordinate system, supports arbitrary resolutions, and supports map tile data in JPG and PNG mixed formats.
The expanded. mbtiles file still uses the metadata table "metadata" and the tile data sheet "tiles" to manage tile map data.
The metadata metadata table stores the relevant settings for the map tile data in the form of key-value pairs, including the field "name" and "value" of the two text types, consistent with the Mbtiles 1.1 specification. Table Structure 1 shows the following:
Figure 1 Table structure of the metadata table
An example of the contents of a metadata table is shown in table 1:
Table 1 Examples of meta-data tables
Name |
Value |
Name |
World |
Type |
Baselayer |
Version |
1.1 |
Description |
World created in 2012-12-17 16:51:22 by Supermap IServer |
Format |
Png |
Bounds |
-180.0,-90.0,180.0,90.0 |
Axis_origin |
-180.0,90.0 |
Axis_positive_direction |
Rightdown |
Crs_wkid |
4326 |
Crs_wkt |
geogcs["WGS 84", datum["wgs_1984", spheroid["WGS", 6378137, 298.257223563, authority["EPSG", "7030"], authority["EPSG", "6326"]], primem["Greenwich", 0, authority["EPSG", "8901"], unit["Degree", 0.0174532925199433, authority["EPSG", "9122"], authority["EPSG", "4326"] |
Tile_height |
256 |
Tile_width |
256 |
Resolutions |
78271.516964,529.1666666666666 |
Scales |
5.0E-7 |
Map_parameter |
{"Scale": 0.00101610071425, "clipregion": {"center": null, "id": 0, "style ... |
Compatible |
False |
|
The fields of the metadata table (keys) are illustrated in table 2:
Table 2 Description of each field in the metadata table
Field name |
Whether you must |
Whether the iServer extension |
Description |
Name |
Is |
Whether |
The English name of the map, if the map name is Chinese, is automatically converted to pinyin for the Chinese name. |
Type |
Is |
Whether |
The map type whose value can be overlay or baselayer. |
Version |
Is |
Whether |
The version of the map tile data, the version of the Mbtiles specification is 1.1. |
Description |
Is |
Whether |
Describe the information. |
Format |
Is |
Whether |
Tile data format: PNG, JPG, or jpg_png, where Jpg_png is a mixed format supported by the V5 cache. |
Bounds |
Whether |
Whether |
The transduction range of the map, whose units are consistent with the map units. The format of bounds in Iserver is: left, bottom, right, on, for example: -180,-85,180,85. |
Axis_origin |
Whether |
Is |
Transduction the location of the origin point. |
Axis_positive_direction |
Whether |
Is |
The enumerated type (Rightdown, Rightup, Leftdown, Leftup) of the positive direction of the axis in the coordinate system, for example: The x-axis to the right y-axis down rightdown. |
Crs_wkid |
Whether |
Is |
The coordinate system's EPSG Code (-1000 is the user-defined coordinate system, and 0 is the normal plane coordinate system). |
Crs_wkt |
Whether |
Is |
The geographic coordinate system information represented by WKT. (wkt: A text markup language developed by the Open Geospatial Consortium (OGC), see: http://docs.geotools.org/stable/javadocs/org/opengis/referencing/doc-files/WKT.html) |
Tile_height |
Whether |
Is |
The height of the tile, usually 256. |
Tile_width |
Whether |
Is |
The width of the tile, usually 256. |
Resolutions |
Whether |
Is |
Resolution set, which corresponds to the resolution of tiles at all levels. |
Scales |
Whether |
Is |
A collection of scale scales corresponding to the resolution of each level. |
Map_parameter |
Whether |
Is |
A JSON string of map default parameters that contains all of the map's feature information, such as the name of the map, the map's scale mapscale, and so on. |
Compatible |
Whether |
Is |
is compatible with the Mbtiles specification, False if the Wkid field is 3857 and if all resolutions in the resolution collection belong to the Mbtiles canonical resolution. |
|
The Tiles tile data sheet includes all tile data and some values for locating tile data. In addition to the MBTiles1.1 specification of Zoom_level, Tile_colum, Tile_row, tile_data Four fields, added resolution field, support any scale, arbitrary resolution. Table Structure 2 shows the following:
Figure 2 Table structure of the Tile data table
Table content for Tile Data Example 3:
Fig. 3 Example of table contents of tile data table
Note: The Zoom_level value is-1 when the tile corresponds to a ground resolution that does not correspond to the ground resolution in table 3.
Read and write tile data according to resolution value or corresponding scale.
Table 3 Mbtiles Each display level parameter list
Display level |
Map width height (pixels) |
Number of slices |
Ground resolution (M/pixel) |
Map Scale (DPI) |
0 |
256 |
1 |
156543.033928 |
1:5,916,587,10.,909,131 |
1 |
512 |
4 |
78271.516964 |
1:2,958,293,55.,454,566 |
2 |
1024 |
16 |
39135.758482 |
1:1,479,146,77.,727,283 |
3 |
2048 |
64 |
19567.879241 |
1:739,573,38.,863,641 |
4 |
4096 |
256 |
9783.939621 |
1:369,786,69.,431,821 |
5 |
8192 |
1024 |
4891.969810 |
1:18,489,334,.71,591 |
6 |
16384 |
4096 |
2445.984905 |
1:92,446,67.,357,955 |
7 |
32768 |
16384 |
1222.992453 |
1:46,223,33.,678,978 |
8 |
65536 |
65536 |
611.496226 |
1:23,111,66.,839,489 |
9 |
131072 |
262144 |
305.748113 |
1:11,555,83.,419,744 |
10 |
262144 |
1048576 |
152.874057 |
1:577791.709872 |
11 |
524288 |
4194304 |
76.437028 |
1:288895.854936 |
12 |
1048576 |
16777216 |
38.218514 |
1:144447.927468 |
13 |
2097152 |
67108864 |
19.109257 |
1:72223.963734 |
14 |
4194304 |
268435456 |
9.554629 |
1:36111.981867 |
15 |
8388608 |
1073741824 |
4.777314 |
1:18055.990934 |
16 |
16777216 |
4294967296 |
2.388657 |
1:9027.995467 |
17 |
33554432 |
17179869184 |
1.194329 |
1:4513.997733 |
18 |
67108864 |
68719476736 |
0.597164 |
1:2256.998867 |
19 |
134217728 |
274877906944 |
0.298582 |
1:1128.499433 |
20 |
268435456 |
1099511627776 |
0.149291 |
1:564.249717 |
21st |
536870912 |
4398046511104 |
0.074646 |
1:282.124858 |
22 |
1073741824 |
17592186044416 |
0.037323 |
1:141.062429 |
|
Tiles Tile Data Table retains a 11-bit significant number (rounded) when resolution stored. Valid number: From the left of the approximate number of the first not 0 of the number, to the exact number, all numbers are called the approximate number of valid digits (0.00123 of the valid number is three-way, the significant number is 3). Examples are shown in table 4:
Table 4 Resolution Approximate calculation example
Resolution actual value |
Approximate values for database storage |
156543.03392804097 |
156543.03393 |
0.00029158412279196264 |
0.00029158412279 |
1.19432856695587 |
1.1943285670 |
|
The reference code for calculating resolution in Java is as follows:
Public Static String getresolutionstring (double resolution) {
int n = (int) Math. log10 (resolution);
int precision = 11;
if (Resolution < 1.0) {
n--;
}
int scale = precision-1-N;
return New BigDecimal (resolution). Setscale (Scale, BigDecimal. Round_half_up). toString ();
}
Description of the cache file format based on the Mbtiles specification extension