package geojson

  1. Overview
  2. Docs
type geometry =
  1. | Point
  2. | MultiPoint of int
  3. | LineString of int
  4. | MultiLineString of int * int
  5. | Polygon of int
  6. | MultiPolygon of int * int
  7. | Collection of geometry list
type feature = {
  1. properties : json option;
  2. geometry : geometry;
}
type r =
  1. | FC of feature list
  2. | F of feature
  3. | G of geometry

Generate random geojson

The random module provides a way of quickly constructing random, correct GeoJSON objects. You provide the skeleton of the document using type t and tweaking some of the parameters. For example:

{ let random_structure = FC (List.init 100 (fun _ -> { properties = None; geometry = Point })) }

val random : f:(unit -> float) -> r -> t

random ~f r produces random GeoJSON based on the structure provided by r and using the random float generator f. Note the random geometry maker will follow the rules of GeoJSON (for making Polygons for example).

OCaml

Innovation. Community. Security.