package topojsone

  1. Overview
  2. Docs
type json = json
module Position : sig ... end
module Point : sig ... end
module Arc_index : sig ... end
module MultiPoint : sig ... end
module LineString : sig ... end
module MultiLineString : sig ... end
module Polygon : sig ... end
module MultiPolygon : sig ... end
type geometry =
  1. | Point of Point.t
  2. | MultiPoint of MultiPoint.t
  3. | LineString of LineString.t
  4. | MultiLineString of MultiLineString.t
  5. | Polygon of Polygon.t
  6. | MultiPolygon of MultiPolygon.t
  7. | Collection of t list
and properties = [
  1. | `None
  2. | `Null
  3. | `Obj of (string * json) list
]

The properties associated with a Geometry object can be left out (`None), could be specifically a null value (`Null) or an object.

and t

Constructors

val point : Position.t -> geometry
val multipoint : Point.t array -> geometry
val linestring : Arc_index.t -> geometry
val multilinestring : LineString.t array -> geometry
val polygon : LineString.t array -> geometry
val multipolygon : Polygon.t array -> geometry
val collection : t list -> geometry

Conversion functions

val get_point : geometry -> (Point.t, [> `Msg of string ]) result
val get_point_exn : geometry -> Point.t
val get_multipoint : geometry -> (MultiPoint.t, [> `Msg of string ]) result
val get_multipoint_exn : geometry -> MultiPoint.t
val get_linestring : geometry -> (LineString.t, [> `Msg of string ]) result
val get_linestring_exn : geometry -> LineString.t
val get_multilinestring : geometry -> (MultiLineString.t, [> `Msg of string ]) result
val get_multilinestring_exn : geometry -> MultiLineString.t
val get_polygon : geometry -> (Polygon.t, [> `Msg of string ]) result
val get_polygon_exn : geometry -> Polygon.t
val get_multipolygon : geometry -> (MultiPolygon.t, [> `Msg of string ]) result
val get_multipolygon_exn : geometry -> MultiPolygon.t
val properties : t -> properties

properties t returns the properties associated with a given object. If there aren't any this returns `None. The empty list is the empty object {}.

val geometry : t -> geometry

geometry t returns the geometry associated with the object.

val foreign_members : t -> (string * json) list

foreign_members t will extract the name-value pairs from an object that are not a part of the TopoJSON specification.

val id : t -> json option

id t returns the id associated with a given object. If there aren't any this returns Nones.

val v : ?id:json -> ?properties:properties -> ?foreign_members:(string * json) list -> ?bbox:float array -> geometry -> t

Creates a new Geometry object.

val to_json : t -> json
val of_json : json -> (t, [ `Msg of string ]) result
OCaml

Innovation. Community. Security.