User Tools

Site Tools


cartograph-offline-overlay-format

Cartograph offline overlay format

Cartograph offline overlay files are SQLite databases. A sample file can be downloaded here.

Table: overlays

The overlay points are stored in the table overlays:

CREATE TABLE overlays (overlay_id INTEGER PRIMARY KEY AUTOINCREMENT, 
       overlay_max_lat NUMERIC, overlay_min_lon NUMERIC, overlay_min_lat NUMERIC,
       overlay_max_lon NUMERIC, overlay_name TEXT, overlay_description TEXT, 
       overlay_url TEXT, image_name TEXT, overlay_color_stroke TEXT, 
       overlay_color_fill TEXT, overlay_type INTEGER, overlay_shape TEXT, 
       overlay_min_zoom INTEGER, overlay_max_zoom INTEGER);

Fields:

  • overlay_id: A unique id.
  • overlay_*_lat, overlay_*_lon: The coordinates of the bounding box of the overlay item. For point overlays the top left and bottom right coorindates of the bounding box can be the same (else the center is used).
  • overlay_name: The name of the overlay item (for instance the restaurant's name). Can be empty.
  • overlay_id: The overlay item's description (for instance opening hours). Can be empty.
  • overlay_url: A website for the overlay item. The website can be accessed when clicking on an overlay item on the map. Can be empty.
  • image_name: The image name. Only used if the overlay item is a marker. The image can either be a reference to an image name in the images table or a web address (starting with http: or https:). Note: if an address is used then an internet connection is required for loading the marker image.
  • overlay_color_stroke: The stroke (border) color. The color should be in hexadecimal representation, for instance #FF0000 (red). Not used if the shape is a marker.
  • overlay_color_fill: The fill color. The color should be in hexadecimal representation, for instance #FF0000 (red). Not used if the shape is a marker or line.
  • overlay_type: The shape type. The following types are supported:
    • 0: Marker - an image placed in the center of the bounding box.
    • 1: Line - a line along the points stored in overlay_shape.
    • 2: Rectangle - a filled rectangle matching the bounding box.
    • 3: Circle - a circle placed in the center of the bounding box with radius of overlay_max_lon-overlay_min_lon degrees.
    • 4: Polygon - a filled polygon along the points stored in overlay_shape.
  • overlay_shape: A comma separated list of coordinates with at least two coordinates. For instance: lat1,lon1,lat2,lon2,…. This field is optional depending on the overlay_type.
  • overlay_min_zoom: The overlay item is only displayed if the current map zoom level is greater or equal than this value.
  • overlay_max_zoom: The overlay item is only displayed if the current map zoom level is smaller or equal than this value.

Table: info

The info table holds general information about the overlay. Each entry consists of an info_key and info_value pair.

CREATE TABLE info (info_key TEXT, info_value TEXT);

Entries

  • name: The name of the overlay as it will be displayed in the Cartograph app. For instance “Drinking water”. The name can be localized by adding a lower-case country code, for instance for German: name_de.
  • id: A unique id for the overlay. It is important that this id is unique among all overlays from different sources. The id could be for instance of the format com.myserver.myoverlay or sha1(uniqid(date()).
  • description (optional): A description of the overlay. The description can be localized by adding a lower-case country code, for instance for German: description_de.
  • version (optional): The version of the overlay.
  • timestamp (optional): A UTC timestamp in seconds.
  • bb_min_lat, bb_max_lat, bb_min_lon, bb_max_lon (optional): The bounding box over all overlay items.

Table: images

The images table stores the image data for overlay items.

CREATE TABLE images (image_name TEXT, image_format TEXT, image_data BLOB);

Parameters:

  • image_name: A unique image name.
  • image_format: The image format. Supported values are svg, png, and jpg.
  • image_data: The image data in binary format.

Indices

The following indices are recommended to improve performance:

CREATE INDEX index_overlaylocation ON overlays(overlay_min_zoom,overlay_max_zoom,
             overlay_max_lat,overlay_min_lon,overlay_min_lat,overlay_max_lon);
CREATE INDEX index_images ON images(image_name);
CREATE UNIQUE INDEX index_info ON info(info_key);
cartograph-offline-overlay-format.txt · Last modified: 2016/01/24 07:51 by cartograph.eu