Work With GeoJSON Data
The HERE platform supports the use of GeoJSON data. GeoJSON is a format for encoding geographic data using JSON. The GeoJSON format defines a structure for geometries, features, and feature collections of feature objects with geographic geometries such as Points, LineStrings, and Polygons, and free-form name:value properties. The GeoJSON specification is maintained by the Internet Engineering Task Force (IETF). For complete details, see the GeoJSON specification.
Older versions of the GeoJSON standard supported custom coordinate systems. The HERE platform only supports the World Geodetic System 1984 (WGS84) coordinate system.
Configure a Layer for GeoJSON Data
When creating a layer for GeoJSON data, configure the layer as follows:
- The partitioning scheme must be HERE Tile.
- The layer type must be volatile or versioned.
- The content type must be application/vnd.geo+json.
Partition GeoJSON Data
FeatureCollection contains multiple feature objects, each of which has some geometry tying it to the map. A single FeatureCollection might have millions of feature objects spread over the whole world. If the
FeatureCollection is very large or the feature objects are spread over a large geographic area, you may want to divide the
FeatureCollection into multiple
FeatureCollection objects, each stored in its own HERE Tile partition.
The decision of when to divide a large
FeatureCollection depends on what you plan to do with the data and how complex individual feature objects are. Some tasks can be done with millions of features per tile, while others can be slow even with thousands of features. As a general rule for visualizing data, one partition should have less than 20,000 features, or less than 5,000 if they are markers (Point features without a Radius).
One way to divide a large
FeatureCollection into multiple
FeatureCollection objects is based on the center point (centroid) of each feature. To do this, you iterate over the
FeatureCollection and calculate the centroid of each feature. Then, you map each centroid to the HERE Tile which overlaps that point. In the end, all feature objects are mapped to a HERE Tile. Each resulting HERE Tile contains a single
FeatureCollection which in turn contains all features whose centroid overlaps that particular HERE Tile. In this way a large
FeatureCollection becomes multiple
FeatureCollection objects which can be processed in parallel.
You can also divide a large
FeatureCollection based on the first coordinate of the feature geometry rather than the centroid.
Custom GeoJSON Style Properties
The HERE platform supports several custom properties that you can use to add visual styling to features when rendered in the platform portal or using the Data Inspector Library. These properties are not part of the GeoJSON specification, but you can add them to the
properties member of any
features object, which is designed to take custom properties. You can add the following properties:
tooltip renders a pop-up message when you mouse over on the feature. If the
tooltip property is not set, the pop-up is displayed with the list of all other configured
properties for the feature.
- You can use
style.fill to modify the feature color. You can set the color in any format that is supported by THREE.Color():
rgb(255, 0, 0),
rgb(100%, 0%, 0%),
hsl(0, 100%, 50%).
style.width is a property intended for
MultiLineString. It defines the width of the line measured in pixels. The default width is 1px.
radius is a property intended for
MultiPoint. It defines the radius for the circle measured in meters.
Note that when using
MultiPoint, the defined properties will be the same for all points. The same rule applies to
For more information, see the Data Inspector Library Developer's Guide.