GeoJSON Transform

The geojson transform consolidates geographic data into a single GeoJSON feature collection. The generated GeoJSON data can then be used to parameterize other parts of a Vega specification, namely the projection fit parameter. This transform can process both latitude / longitude data and existing GeoJSON features.

Transform Parameters

Property Type Description
fields Field[ ] Data fields containing longitude and latitude values, respectively.
geojson Field Data field containing GeoJSON feature objects.

Usage

In the midst of a data transform array, one can include a geojson transform and bind it to a new signal name (here, geodata):

{
  "type": "geojson",
  "fields": ["longitude", "latitude"],
  "signal": "geodata"
}

Elsewhere, the geodata signal can be used to refer to the consolidated GeoJSON data, as in a projection:

"projections": [
  {
    "name": "proj",
    "type": "mercator",
    "fit": {"signal": "geodata"}
  }
]