mirror of
https://github.com/maplibre/martin.git
synced 2024-12-24 15:34:51 +03:00
6f32f0e7b4
Feature for `Mbtiles` struct to detect which format a `.mbtiles` file is in according to the [MBTiles specfication](https://github.com/mapbox/mbtiles-spec/blob/master/1.3/spec.md#database). The function `detect_type` identifies whether the `.mbtiles` file contains a `tiles` _table_ OR if it contains `map` and `images` table (which provide the data for a `tiles` _view_). See also #667
165 lines
5.6 KiB
JSON
165 lines
5.6 KiB
JSON
{
|
|
"db": "SQLite",
|
|
"09e15d4479a96829f8dcd93e6f40f7e5f487f6c33614aa82ae3716e3bb932dfa": {
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"name": "is_valid",
|
|
"ordinal": 0,
|
|
"type_info": "Int"
|
|
}
|
|
],
|
|
"nullable": [
|
|
false
|
|
],
|
|
"parameters": {
|
|
"Right": 0
|
|
}
|
|
},
|
|
"query": "SELECT (\n -- Has a \"map\" table\n SELECT COUNT(*) = 1\n FROM sqlite_master\n WHERE name = 'map'\n AND type = 'table'\n --\n ) AND (\n -- \"map\" table's columns and their types are as expected:\n -- 4 non-null columns (zoom_level, tile_column, tile_row, tile_id).\n -- The order is not important\n SELECT COUNT(*) = 4\n FROM pragma_table_info('map')\n WHERE \"notnull\" = 0\n AND ((name = \"zoom_level\" AND type = \"INTEGER\")\n OR (name = \"tile_column\" AND type = \"INTEGER\")\n OR (name = \"tile_row\" AND type = \"INTEGER\")\n OR (name = \"tile_id\" AND type = \"TEXT\"))\n --\n ) AND (\n -- Has a \"images\" table\n SELECT COUNT(*) = 1\n FROM sqlite_master\n WHERE name = 'images'\n AND type = 'table'\n --\n ) AND (\n -- \"images\" table's columns and their types are as expected:\n -- 2 non-null columns (tile_id, tile_data).\n -- The order is not important\n SELECT COUNT(*) = 2\n FROM pragma_table_info('images')\n WHERE \"notnull\" = 0\n AND ((name = \"tile_id\" AND type = \"TEXT\")\n OR (name = \"tile_data\" AND type = \"BLOB\"))\n --\n ) AS is_valid;\n"
|
|
},
|
|
"386a375cf65c3e5aef51deffc99d23bd852ba445c1058aed380fe83bed618c29": {
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"name": "value",
|
|
"ordinal": 0,
|
|
"type_info": "Text"
|
|
}
|
|
],
|
|
"nullable": [
|
|
true
|
|
],
|
|
"parameters": {
|
|
"Right": 1
|
|
}
|
|
},
|
|
"query": "SELECT value from metadata where name = ?"
|
|
},
|
|
"5b298df51dccbf0d8a22433a99febc59c27dbf204d09a9c1fb0b3bf9aaad284b": {
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"name": "tile_column",
|
|
"ordinal": 0,
|
|
"type_info": "Int64"
|
|
},
|
|
{
|
|
"name": "tile_row",
|
|
"ordinal": 1,
|
|
"type_info": "Int64"
|
|
},
|
|
{
|
|
"name": "tile_data",
|
|
"ordinal": 2,
|
|
"type_info": "Blob"
|
|
}
|
|
],
|
|
"nullable": [
|
|
true,
|
|
true,
|
|
true
|
|
],
|
|
"parameters": {
|
|
"Right": 1
|
|
}
|
|
},
|
|
"query": "SELECT tile_column, tile_row, tile_data FROM tiles WHERE zoom_level = ? LIMIT 1"
|
|
},
|
|
"60264fa07915878b3f7ba0067f48c3a379e96acbdf5fc52d14e29bc726fefab7": {
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"name": "tile_data",
|
|
"ordinal": 0,
|
|
"type_info": "Blob"
|
|
}
|
|
],
|
|
"nullable": [
|
|
true
|
|
],
|
|
"parameters": {
|
|
"Right": 3
|
|
}
|
|
},
|
|
"query": "SELECT tile_data from tiles where zoom_level = ? AND tile_column = ? AND tile_row = ?"
|
|
},
|
|
"748436831449877b242d6e167a2f8fe1b1e7b6fb87c4e04ad7406a2bbfd35bec": {
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"name": "zoom_level",
|
|
"ordinal": 0,
|
|
"type_info": "Int64"
|
|
},
|
|
{
|
|
"name": "tile_column",
|
|
"ordinal": 1,
|
|
"type_info": "Int64"
|
|
},
|
|
{
|
|
"name": "tile_row",
|
|
"ordinal": 2,
|
|
"type_info": "Int64"
|
|
},
|
|
{
|
|
"name": "tile_data",
|
|
"ordinal": 3,
|
|
"type_info": "Blob"
|
|
}
|
|
],
|
|
"nullable": [
|
|
true,
|
|
true,
|
|
true,
|
|
true
|
|
],
|
|
"parameters": {
|
|
"Right": 0
|
|
}
|
|
},
|
|
"query": "SELECT zoom_level, tile_column, tile_row, tile_data FROM tiles WHERE zoom_level >= 0 LIMIT 1"
|
|
},
|
|
"78d1356063c080d9bcea05a5ad95ffb771de5adb62873d794be09062506451d3": {
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"name": "is_valid",
|
|
"ordinal": 0,
|
|
"type_info": "Int"
|
|
}
|
|
],
|
|
"nullable": [
|
|
false
|
|
],
|
|
"parameters": {
|
|
"Right": 0
|
|
}
|
|
},
|
|
"query": "SELECT (\n -- Has a \"tiles\" table\n SELECT COUNT(*) = 1\n FROM sqlite_master\n WHERE name = 'tiles'\n AND type = 'table'\n --\n ) AND (\n -- \"tiles\" table's columns and their types are as expected:\n -- 4 non-null columns (zoom_level, tile_column, tile_row, tile_data).\n -- The order is not important\n SELECT COUNT(*) = 4\n FROM pragma_table_info('tiles')\n WHERE \"notnull\" = 0\n AND ((name = \"zoom_level\" AND type = \"INTEGER\")\n OR (name = \"tile_column\" AND type = \"INTEGER\")\n OR (name = \"tile_row\" AND type = \"INTEGER\")\n OR (name = \"tile_data\" AND type = \"BLOB\"))\n --\n ) as is_valid;\n"
|
|
},
|
|
"d6ac76a234c97d0dc1fc4331d8b2cd90903d5401f8f0956245e5163bedd23a4d": {
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"name": "name",
|
|
"ordinal": 0,
|
|
"type_info": "Text"
|
|
},
|
|
{
|
|
"name": "value",
|
|
"ordinal": 1,
|
|
"type_info": "Text"
|
|
}
|
|
],
|
|
"nullable": [
|
|
true,
|
|
true
|
|
],
|
|
"parameters": {
|
|
"Right": 0
|
|
}
|
|
},
|
|
"query": "SELECT name, value FROM metadata WHERE value IS NOT ''"
|
|
}
|
|
} |