Skip to content

DTVF: GeoJSON

Markus Hofmeister edited this page Nov 24, 2021 · 6 revisions

GeoJSON files are used by the DTVF to specify the locations of features and each location's visualisation properties. At the time of writing, it's intended that GeoJSON files only contain the locations of features and their visualisation properties; metadata to be shown to the visualisation viewer should be located within one of the associated *-meta.json files.

GeoJSON files for use with the DTVF are expected to follow the standard GeoJSON format with a few small additions. Each feature (i.e. location) within a GeoJSON file should have:

  • A numerical id field that is unique across all features within that file. That id field should also be nested within the feature node, but not within the properties group (this format is required by some of our mapping library's additional features).
  • A displayName property. This is the field that the visualisation will use for the user facing name of the location.
  • An optional description property can also be provided; by default, the displayName and description field (if present) will be displayed when the user hovers their mouse over a point location.

Each GeoJSON should contain a single type of location (i.e. do not mix Points with Polygons or LineStrings), and will be represented by a single map layer. For more details on the supported location types, see the Data Structure page.

Feature Properties

A number of visualisation properties can also be set to style the data. If these properties require more complicated logic (e.g. coloring based on some other property), then the visualisation developer will need to handle this outside of the central framework using the data-driven features that MapBox provides. If these visualisation properties are omitted, the framework will assign default ones.

MapBox provides a large number of visualisation properties, but these cannot be pulled automatically from the GeoJSON file. A key must be agreed upon and used in the GeoJSON's properties, then piped through to the MapBox API upon layer creation.

To add support for additional visualisation properties, please check that the feature is supported by MapBox; if it is then contact the system administrators at CMCL to add support for it within the framework.

A breakdown of the visualisation properties that the DTVF supports, for each location type, is shown below:

Point properties

Supported visualisation properties for point or circle location types are:

Fill properties

Supported visualisation properties for fill or polygon location types are:

  • fill-color: color hexstring, defaults to a random color.

Extrusion properties

Supported visualisation properties for extrusion or building location types are:

  • fill-extrusion-base: the height of the building's base in metres, defaults to 0. Must be less than or equal to fill-extrusion-height
  • fill-extrusion-color: color hexstring, defaults to #60959F.
  • fill-extrusion-height: the height of the building's top in metres, defaults to 25. The actual (relative) building height is the difference of fill-extrusion-height and fill-extrusion-base

Example: A 10m tall building at 20m base elevation has fill-extrusion-base: 20 and fill-extrusion-height: 30

Line properties

Supported visualisation properties for line location types are:

Symbol properties

Supported visualisation properties for symbol location types are:

  • icon-image: name of pre-registered icon, must be present.