Files
MapLibreParticleLab/platform/default/include/mbgl/storage/offline_schema.sql
Petr Pokorny d62ff400c6 Replacing hardcoded configuration with configurable API and removing Mapbox assets (#90)
* Refactoring online file source so that tile server configuration is not hardcoded - part 1

* Added default templates

* Update from master

* Renaming MGLAccountManager to MGLSettings. Passing ResourceOptions and TileServerOptions to relevant classes and method in order to remove mapbox hardocded configuration

* Fixing build

* Addedm missing theme

* Unit tests fixes

* Fixing unit tests, adding factory methods for creating predefined configuration.

* Fixing mapbox unit tests

* Additional unit test fixes

* Making MapboxConfiguration default

* Making get/set resource options available in all classes that inherits from FileSource

* Making get/set resource options available in all classes that inherits from FileSource - part 2

* Fixes for Android

* Disable test coverage reports

* Disable test coverage reports

* Disable test coverage reports

* Disable test coverage reports

* Removing hardcoded configuration in iOS project - part 1

* Fixing wrong file extension, making use of tile server options.

* Use apiKey and MGL_API_KEY everywhere

* Just a rename

* Re-enabling tests and improving MGLSettings init

* Removing mapbox hardcoded configuration, using api key everywhere, implementing JNI conversion for TileServerOptions

* Lint issues.

* Integrating configurable tile server properties into Android SDK - part 2

* Removing mabox accounts

* Exposing multiple configurations to Android SDK - bug fixes

* Removing TileServerOptions from public interface - native methods dont work before mapbox-gl library is loaded

* Adding support for configurable predefined styles

* Migrating predefined styles in test app + cleanup

* Parameter fix

* Bug fixes

* Fixing render test build

* Fixing offline tester

* Fixing benchmark tool

* Fix: typo in method name

* Adding code for public access to TileServerOptions

* Bug fixes and debug code removal

* Fixes for macOS, adding unit tests from MapLibre, removing redundant members from OnlineFileSource

* Unit test fixes

* MacOS test app - migrating to configurable tile server options, part 1

* Fixing offline maps

* Migrating macOS test app to MapTiler

* Minor improvements

* Putting back apiKey test

* Added unit tests for MapTiler configuration

* Migrating test resources to MapTiler

* minor fix

* A few fixes

* Fixing macOS tests, removing feedback functionality

* Migrating ios test app to MapTiler

* Migrating ui tests

* UI tests fix

* Benchmarking app fix

* Cleanup and strings updates

* Migrating benchmark app to maptiler

* API key injection in benchmark app

* Putting back release configuration

* Additional tests and fixing issues identified by thread sanitizer.

* Removing test filters

* Fixes and addressing lint issues

* More Maptiler tests + minro fix

* Android instrumentation test migration to MapTiler. Exposing missing TileServerOptions in Android SDK. Minor fixes.

* No requirements on API key format.

* Fixing offline cache test tool

* Adding configurable domain name for sources, adding source domain int MapTiler configuration, cleanup

* Migrating tests to MapTiler, adding code for canonicalizing URLs, removing mapbox stuff from comments, cleanup

* More tests

* Updated database size

* Lint issues

* Fixed test

* Updating developer config API key

* Fixes for Android, propagaing updated tileServerOptions to native file sources, more tests

* Just a few more fixes

* Propagating updated settings to file sources + additional unit test

* Lint issues

* Removing test filter and fixing incorrect uri

* Release preparation

* macos release notes
2021-06-29 12:44:51 +02:00

166 lines
7.6 KiB
SQL

--
-- Table containing the style, source, sprite, and glyph
-- resources. Essentially everything that is not a tile.
--
CREATE TABLE resources (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, -- Primary key.
url TEXT NOT NULL, -- The URL of the resource without the access token.Must be
-- unique and that is enforced by the database schema.
kind INTEGER NOT NULL, -- Type of the resource, taken from Resource::Kind enumeration:
-- style = 1
-- source = 2
-- tile = 3
-- glyphs = 4
-- sprite image = 5
-- sprite JSON = 6
-- image = 7
expires INTEGER, -- Expiration time. The resource will be refreshed after this
-- expiration is reached.
modified INTEGER, -- Last time the resource was modified.
etag TEXT, -- Checksum used for cache optimization. If, when refreshing the
-- resource, it matches the etag on the server, the resource will
-- not get re-downloaded. See:
-- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
data BLOB, -- Contents of the resource.
compressed INTEGER NOT NULL DEFAULT 0, -- If the resource is compressed with Deflate or not. Compression is
-- optional and should be used when the compression ratio is
-- significant. Using compression will make decoding time slower
-- because it will add an extra decompression step.
accessed INTEGER NOT NULL, -- Last time the resource was used by GL Native. Useful for when
-- evicting the least used resources from the cache.
must_revalidate INTEGER NOT NULL DEFAULT 0, -- When set to true, the resource will not be used unless it gets
-- first revalidated by the server.
UNIQUE (url)
);
--
-- Table containing all tiles, both vector and raster.
--
CREATE TABLE tiles (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, -- Primary key.
url_template TEXT NOT NULL, -- The URL of the resource without the access token and without
-- the tiles id substituted.
pixel_ratio INTEGER NOT NULL, -- The tile pixel ratio, typically 1 for vector tiles.
z INTEGER NOT NULL, -- The zoom level of the tile.
x INTEGER NOT NULL, -- The x position of the tile on the tile grid.
y INTEGER NOT NULL, -- The y position of the tile on the tile grid.
expires INTEGER, -- Expiration time. The tile will be refreshed after this
-- expiration is reached. Expired tiles can still be rendered,
-- unless must_revalidate is set to true. If an expired tile
-- gets rendered, it will be replaced by a newer version as soon
-- as the network request with a new tile arrives.
modified INTEGER, -- Last time the tile was modified.
etag TEXT, -- Checksum used for cache optimization. If, when refreshing the
-- tile, it matches the etag on the server, the tile will not
-- get re-downloaded. See:
-- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
data BLOB, -- Contents of the tile.
compressed INTEGER NOT NULL DEFAULT 0, -- If the tile is compressed with Deflate or not. Compression is
-- optional and should be used when the compression ratio is
-- significant. Using compression will make decoding time slower
-- because it will add an extra decompression step.
accessed INTEGER NOT NULL, -- Last time the tile was used by GL Native. Useful for when
-- evicting the least used tiles from the cache.
must_revalidate INTEGER NOT NULL DEFAULT 0, -- When set to true, the tile will not be used unless it gets
-- first revalidated by the server.
UNIQUE (url_template, pixel_ratio, z, x, y)
);
--
-- Regions define the offline regions, which could be a GeoJSON geometry,
-- or a bounding box like this example:
--
-- {
-- "bounds": [
-- 37.2,
-- -122.8,
-- 38.1,
-- -121.7
-- ],
-- "include_ideographs": false,
-- "max_zoom": 15.0,
-- "min_zoom": 0.0,
-- "pixel_ratio": 1.0,
-- "style_url": "maptiler://maps/streets"
-- }
--
-- The semantic definition of the region is up to the user and
-- it could be a city, a country or an arbitrary bounding box.
--
-- Regions can overlap, which will cause them to share resources
-- when it is the case.
--
-- "include_ideographs" is set to true when CJK characters are
-- include on the offline package. By default, CJK is rendered
-- by GL Native client side using local fonts. Downloading CJK
-- will increase the size of the database considerably.
--
CREATE TABLE regions (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, -- Primary key.
definition TEXT NOT NULL, -- JSON formatted definition of a region, a bounding box
-- or a GeoJSON geometry. See https://geojson.org.
description BLOB -- User provided data in user-defined format.
);
--
-- Table mapping resources to regions. A resource
-- might be part of many regions. Resources without
-- regions are part of the ambient cache.
--
CREATE TABLE region_resources (
region_id INTEGER NOT NULL REFERENCES regions(id) ON DELETE CASCADE,
resource_id INTEGER NOT NULL REFERENCES resources(id),
UNIQUE (region_id, resource_id)
);
--
-- Table mapping tiles to regions. A tile might
-- be part of many regions, meaning that regions might
-- overlap efficiently. Tiles without regions are part
-- of the ambient cache.
--
CREATE TABLE region_tiles (
region_id INTEGER NOT NULL REFERENCES regions(id) ON DELETE CASCADE,
tile_id INTEGER NOT NULL REFERENCES tiles(id),
UNIQUE (region_id, tile_id)
);
--
-- Indexes for efficient eviction queries.
--
CREATE INDEX resources_accessed
ON resources (accessed);
CREATE INDEX tiles_accessed
ON tiles (accessed);
CREATE INDEX region_resources_resource_id
ON region_resources (resource_id);
CREATE INDEX region_tiles_tile_id
ON region_tiles (tile_id);