Class: TopoJSON

ol.format.TopoJSON


import TopoJSON from 'ol/format/topojson';

Feature format for reading data in the TopoJSON format.

new ol.format.TopoJSON(opt_options)

src/ol/format/topojson.js, line 25
Name Type Description
options

Options.

Name Type Description
defaultDataProjection ol.ProjectionLike

Default data projection. Default is EPSG:4326.

layerName string | undefined

Set the name of the TopoJSON topology objects's children as feature property with the specified name. This means that when set to 'layer', a topology like

{
  "type": "Topology",
  "objects": {
    "example": {
      "type": "GeometryCollection",
      "geometries": []
    }
  }
}

will result in features that have a property 'layer' set to 'example'. When not set, no property will be added to features.

layers Array.<string> | undefined

Names of the TopoJSON topology's objects's children to read features from. If not provided, features will be read from all children.

Extends

Members

readProjection

Read the projection from a TopoJSON source.

Methods

readFeatures(source){Array.<ol.Feature>}

src/ol/format/topojson.js, line 288

Read all features from a TopoJSON source.

Name Type Description
source Document | Node | Object | string

Source.

Returns:
Features.