Module Cosmetyc_native.Basic

include module type of Cosmetyc.Basic

OpenStreetMap Objects

Nodes

A representation for OSM nodes.

val node_id : node -> Cosmetyc.Common.Id.t

Get the identifier of a node.

val node_tags : node -> Cosmetyc.Common.Tags.t

Get all the tags (key/value) of a node.

val node_position : node -> Cosmetyc.Common.Position.t

The position of a node, in spherical coordinates.

Smart constructor for node. If no identifier is provided, a new one will be generated.

Ways

A representation for OSM ways.

val way_id : way -> Cosmetyc.Common.Id.t

Get the identifier of a way.

val way_tags : way -> Cosmetyc.Common.Tags.t

Get all the tags (key/value) of a way.

val way_nodes : way -> node list

Get the list of nodes of a way.

val create_way : ?id:Cosmetyc.Common.Id.t -> ?tags:Cosmetyc.Common.Tags.t -> node list -> way

Smart constructor for node. If no identifier is provided, a new one will be generated.

Relations

A representation for OSM relations.

val relation_id : relation -> Cosmetyc.Common.Id.t

Get the identifier of a relation.

val relation_tags : relation -> Cosmetyc.Common.Tags.t

Get all the tags (key/value) of a relation.

type role = string

The role of a relation member. It may be the empty string.

type object_type = Cosmetyc.Repr.Raw.obj =
  1. | Node of node
  2. | Way of way
  3. | Relation of relation

A type to represent objects, of whichever kind.

val relation_members : relation -> (role * object_type) list

Get all the members of a relation, as well as their associated role.

val create_relation : ?id:Cosmetyc.Common.Id.t -> ?tags:Cosmetyc.Common.Tags.t -> (role * object_type) list -> relation

Smart constructor for node. If no identifier is provided, a new one will be generated.

OSM Data

type flux = object_type Stdlib.Seq.t

A flux of OSM objects

Input: getting OSM data from external sources

exception Parse_error of string

An exception that can be raised by the following input functions.

val read_GeoJson : Stdlib.in_channel -> flux

Parse a GeoJson file in a channel. The channel will be closed by the function.

val read_GeoJson_string : string -> flux

Parse a string representing the content of a GeoJson file.

val read_OSM_XML : Stdlib.in_channel -> flux

Parse an OSM XML file in a channel. The channel will be closed by the function.

val read_OSM_XML_string : string -> flux

Parse a string representing the content of an OSM XML file.

Output: exporting data to external locations

exception Write_error of string

An exception that can be raised by the following output functions.

val write_OSM_XML : ?indent:bool -> Stdlib.out_channel -> flux -> unit

Output an OSM XML file into an out-channel.

val write_OSM_XML_string : ?indent:bool -> flux -> string

Output an OSM XML file into a string. The optional argument states whether it should be indented.

val render_png : string -> Cosmetyc.Common.Bbox.Wrap.t -> float -> flux -> unit

Given a file name, a bounding box, and a scale factor (in pixel per meter), outputs the objects into a PNG file.

val render_pdf : string -> Cosmetyc.Common.Bbox.Wrap.t -> float -> flux -> unit

Given a file name, a bounding box, and a scale factor (in pixel per meter), outputs the objects into a PDF file.

val render_svg : string -> Cosmetyc.Common.Bbox.Wrap.t -> float -> flux -> unit

Given a file name, a bounding box, and a scale factor (in pixel per meter), outputs the objects into an SVG file.