-
Notifications
You must be signed in to change notification settings - Fork 26
DTVF: GeoJSON
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. Thatid
field should also be nested within the feature node, but not within theproperties
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, thedisplayName
anddescription
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.
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:
Supported visualisation properties for point
or circle
location types are:
-
circle-color
: color hexstring, defaults to a random color. -
circle-opacity
: opacity value (0.0 to 1.0), defaults to 1.0. -
circle-stroke-color
: color hexstring, defaults to a random color. -
circle-stroke-opacity
: opacity value (0.0 to 1.0), defaults to 1.0. -
circle-stroke-width
: outline thickness, defaults to 1
Supported visualisation properties for fill
or polygon
location types are:
-
fill-color
: color hexstring, defaults to a random color.
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 tofill-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 offill-extrusion-height
andfill-extrusion-base
Example: A 10m tall building at 20m base elevation has fill-extrusion-base
: 20 and fill-extrusion-height
: 30
Supported visualisation properties for line
location types are:
-
line-color
: color hexstring, defaults to a random color. -
line-opacity
: opacity factor (0.0 to 1.0), defaults to 0.5 -
line-width
: width integer, defaults to 3
Supported visualisation properties for symbol
location types are:
-
icon-image
: name of pre-registered icon, must be present.
- Home
- FAQ
- How to contribute
- Development guidelines:
- Containerisation:
- Examples
- Handling data:
- Visualisations: