UTFGrid format attribute tiles |
UTFGrid is a specification developed by MapBox for storing attribute map data to SQLite database and quickly using, managing and sharing the data. The specification is published by MapBox, please refer to http://www.mapbox.com/demo/visiblemap for details.
UTFGrid employs Unicode characters to encode geographic features into data tiles that save space. The tile is called Grid and stored in SQLite database.
SuperMap iServer extend UTFGrid based on original specification to satisfy the needs. After the extension, the .utfgrid file keeps the metadata table "metadata" and any coordinate system and resolution are supported.
Name of UTFGrid file is composed of map name, layer name, EPSG Code, tile width and height, pixCell, and the .utfgrid extension (for example, World_Countries@World_4326_256X256_8.utfgrid). Please refer to CoordSysType for EPSG Code, and pixCell of table 2 for pixCell.
The structure of the database table is as follows:
The metadata table employs key-value pair to store settings of map properties data, including two fields of the text type "name" and "value", which are identical to utfgrid1.0.0. The structure of the table is illustrated in table 1:
Table 1 metadata table example
name |
value |
name | World |
layerName |
Countries@World |
version | 1.0.0 |
description | World created on 2013-07-23 17:27:18 by SuperMap iServer |
format | json |
bounds |
-180.000,-90.000,180.000,90.000 |
ext_spec_version | 201310 |
axis_origin | -180.0,90.0 |
axis_positive_direction |
RightDown |
crs_wkid |
4326 |
crs_wkt |
GEOGCS["GCS_WGS_1984", DATUM["D_WGS_1984", SPHEROID["WGS_1984",6378137.0,298.2572235630001,AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]], UNIT["DEGREE",0.017453292519943295], AUTHORITY["EPSG","4326"]] |
tile_height | 256 |
tile_width | 256 |
resolutions | 0.34886137129 |
scales |
1.4677821811243212E8 |
pixCell |
8 |
Table 2 shows the fields' description of metadata table.
Table 2: Description of fields in metadata table
Field name | Required or not | iServer extension or not | Description |
name | Yes | No | Name of map. |
layerName |
Yes | No | Layer name. |
version | Yes | No | UTFGrid version specification. Version of UTFGrid specification is 1.0.0. |
description | Yes | No | Descriptive information. |
format | Yes | No | UTFGrid format: json, html, jsonp, rjson. |
bounds | No | No | Map extent used to acquire attribute data, with the unit being the map units. The format of bounds of iServer is as follows: -180, -85, 180, 85. |
ext_spec_version | No | Yes | Version extended based on MBTiles specification by SuperMap iServer, 201310 here for instance. |
axis_origin | No | Yes | The position of the tiling origin. |
axis_positive_direction | No | Yes | Enumeration of positive directions of the axes of the coordinate system (RightDown, RightUp, LeftDown, LeftUp). |
crs_wkid | No | Yes | EPSG Code of the coordinate system (-1000 indicates the custom coordinate system and 0 indicates common planar coordinate system). |
crs_wkt | No | Yes | The geographic coordinate system represented by wkt. (wkt: A text markup language developed by OGC. For details, please refer to http://docs.geotools.org/stable/javadocs/org/opengis/referencing/doc-files/WKT.html) |
tile_height | No | Yes | The grid height, generally 256. |
tile_width | No | Yes | The grid width, generally 256. |
resolutions | No | Yes | Resolution set, resolutions corresponding to different levels of tiles. |
scales | No | Yes | Collection of scales corresponding to different levels resolutions. |
pixCell | No | Yes | Pixel width of each cell in the grid. |
grid_utfgrid table is used to record grid_id and utfgrid in utfgrid. The structure of the table is as follows:
Table 3 grid_utfgrid table filed description
Field name | Data type | Description |
grid_id | TEXT | Grid ID |
grid_utfgrid | BOLB | UTFGrid data |
Example of table contents is as follows:
The map table is used to record row number, column number, resolution, id corresponding to the grid, scale, tile level, time for tile creation, etc. of each grid. The structure of the table is as follows:
Table 4 grid_utfgrid table filed description
Field name | Data type | Description |
zoom_level | integer | Tile level, with -1 indicating custom scale set. |
resolution | varchar | Resolution corresponding to the tile. |
tile_colum | integer | The column number of the tile. |
tile_row |
integer |
The row number of the tile. |
grid_id | TEXT | Grid ID. |
create_time | TEXT | The time when the tile is created. |
Example of table contents is as follows:
The keymap table is used to record geographic feature information and the key_name value. Each geographic feature corresponds to a key_name value, that is, the SMID value of the geographic feature. The structure of the table is as follows:
Table 5 keymap Table Field Description
Field name | Data type | Description |
key_name |
TEXT | UTFGrid ID. |
key_json |
BOLB | The json format data of the geographic feature information. |
Example of table contents is as follows:
The grid_key table is used to record key_name values corresponding to each grid cell. Each grid_id corresponds to multiple key_name values, that is, a grid cell has multiple geographic features. The structure of the table is as follows:
Table 6 grid_key table filed description
Field name | Data type | Description |
grid_id |
TEXT | Grid ID. |
key_name |
integer |
key name. |
Example of table contents is as follows: