Page
Library
Module
Module type
Parameter
Class
Class type
Source
Topojson.Make
SourceA functor that takes a Json parsing implementation and returns a TopoJSON parser and constructor.
TopoJSON objects are primarily made up of geometry primitives that are the same as those used in Geojson
. For example you can have a single Point
or Linestring
.
These are grouped under the Geometry
module and in particular the Geometry.geometry
type. These can be accessed and pattern-matched against using the Geometry.geometryfunction
. For example:
let is_linestring t =
let open Topojson in
match Geometry.geometry t with
| Geometry.LineString _ -> true
| _ -> false
The Topology.t
is the most common TopoJSON object for the main document. This contains a map of geometry objects along with other important components of the topology including the arc index and transform information.
Finally we have the main TopoJSON object. Most frequently this will be a Topology.t
but could technically be a standalone Geometry.t
according to the specification.
type topojson =
| Topology of Topology.t
| Geometry of Geometry.t
The underlying TopoJSON datastructure.
*)The TopoJSON object.
Accessor for the TopoJSON data. This will try to access a Topology.t
.contents
Accessor for the optional bounding-box for the entire TopoJSON object.
Construct a new TopoJSON object, optionally with a bounding-box.
of_json json
converts the JSON to a topojson object (a type t
) or an error.