Data model is important to understand how utymap renders scene from raw vector map data.
Elements (Node, Way, Area, Relation) are basic components of UtyMap's conceptual data model which is inspired by OpenStreetMap (see osm docs) In general, data model consists of the following primitives:
- Node - point specified by latitude and longitude. Used to define some POI (Place Of Interest) on map.
- Way - open polyline specified by two or more points. Common usage is roads.
- Area - closed polygon specified by three or more points. Widely used for simple buildings, terrain regions (green zones, water, etc.)
- Relation - union of nodes, ways, areas or relations. Used for specifying complex shaped buildings, terrain regions, etc.
Each primitive has unique ID and set of tags. Tags define actual object represented by element data. Based on their location, all elements are grouped inside one or more quadkey. Each quadkey is defined by zoom (level of details), x, y (longitude and latitude). UtyMap uses Bing Maps quadkey schema.
Tag is just key-value pair, e.g. building=yes or kind=forest. Actual values depend on raw data schema used by specific data source meaning that active mapcss has to use this schema. For example, OpenStreetMap defines some park areas as leisure=park, but mapzen uses kind=park. Utymap does not perform any tag normalization in source code, instead, different mapcss styles has to be specified and used.
Currently, utymap can import data from the following formats:
- osm pbf
- osm xml
- geojson
- shape
During import, data is converted into internal format which supports simple geo spatial requests. There are two types of data storage:
- in-memory - stores all data in memory and all changes are discarded after application is unloaded. This type is useful for storing all changes applied to map data temporary (e.g. adding or removing new buildings).
- persistent - stores data on disc in UtyMap's own format. This type is used for importing large regions once as import operation may take a lot of time and consumes RAM. Hint: you can import region on one device and copy to another.
You can use more than one data storage of given types (actually, there is no limit). It might be useful to implement custom save or role management systems.
Version 2.1. adds mesh caching mechanism which stores generated terrain meshes on disk to avoid expensive calculations for unchanged data. It is enabled by default and can be disabled if needed.
Another optimization is reducing amount of data rendered by default. Can be easily done by revising mapcss rules.
This is in TODO list. General idea is to use compression for all persistent data.