Skip to content

Latest commit

 

History

History
252 lines (186 loc) · 12 KB

API.md

File metadata and controls

252 lines (186 loc) · 12 KB

geojson-to-gml-3

A library of functions to convert geojson to GML.

geojson-to-gml-3.config : Object

Configuration for this module.

Kind: static constant of geojson-to-gml-3

geojson-to-gml-3.point(coords, gmlId, params) ⇒ String

Converts an input geojson Point geometry to gml

Kind: static method of geojson-to-gml-3
Returns: String - a string containing gml representing the input geometry

Param Type Description
coords Array.<Number> the coordinates member of the geojson geometry
gmlId String | Number the gml:id
params Params optional parameters

geojson-to-gml-3.lineString(coords, gmlId, params) ⇒ String

Converts an input geojson LineString geometry to gml

Kind: static method of geojson-to-gml-3
Returns: String - a string containing gml representing the input geometry

Param Type Description
coords Array.<Array.<Number>> the coordinates member of the geojson geometry
gmlId String | Number the gml:id
params Params optional parameters

geojson-to-gml-3.linearRing(coords, gmlId, params) ⇒ String

Converts an input geojson LinearRing member of a polygon geometry to gml

Kind: static method of geojson-to-gml-3
Returns: String - a string containing gml representing the input geometry

Param Type Description
coords Array.<Array.<Number>> the coordinates member of the geojson geometry
gmlId String | Number the gml:id
params Params optional parameters

geojson-to-gml-3.polygon(coords, gmlId, params) ⇒ String

Converts an input geojson Polygon geometry to gml

Kind: static method of geojson-to-gml-3
Returns: String - a string containing gml representing the input geometry

Param Type Description
coords Array.<Array.<Array.<Number>>> the coordinates member of the geojson geometry
gmlId String | Number the gml:id
params Params optional parameters

geojson-to-gml-3.multiPoint(coords, gmlId, params) ⇒ String

Converts an input geojson MultiPoint geometry to gml

Kind: static method of geojson-to-gml-3
Returns: String - a string containing gml representing the input geometry

Param Type Description
coords Array.<Array.<Number>> the coordinates member of the geojson geometry
gmlId String | Number the gml:id
params Params optional parameters

geojson-to-gml-3.multiLineString(coords, gmlId, params) ⇒ String

Converts an input geojson MultiLineString geometry to gml

Kind: static method of geojson-to-gml-3
Returns: String - a string containing gml representing the input geometry

Param Type Description
coords Array.<Array.<Array.<Number>>> the coordinates member of the geojson geometry
gmlId String | Number the gml:id
params Params optional parameters

geojson-to-gml-3.multiPolygon(coords, gmlId, params) ⇒ String

Converts an input geojson MultiPolygon geometry to gml

Kind: static method of geojson-to-gml-3
Returns: String - a string containing gml representing the input geometry

Param Type Description
coords Array.<Array.<Array.<Array.<Number>>>> the coordinates member of the geojson geometry
gmlId String | Number the gml:id
params Params optional parameters

geojson-to-gml-3.makeTranslator(obj)

A helper to map geometry types to converter functions.

Kind: static method of geojson-to-gml-3

Param Type Description
obj Object an object mapping camelcase-d geometry type names to converter functions for that type.

Example

import {point, lineString} from 'geojson-to-gml-3';
const geomToGml = makeTranslator({point, lineString});
geomToGml({type: 'Point', coordinates: [0, 0]});

geojson-to-gml-3.geometryCollection(coords, gmlId, params) ⇒ String

Converts an input geojson GeometryCollection geometry to gml

Kind: static method of geojson-to-gml-3
Returns: String - a string containing gml representing the input geometry

Param Type Description
coords Array.<Object> the coordinates member of the geojson geometry
gmlId String | Number the gml:id
params Object optional parameters
params.srsName String as string specifying SRS
params.srsDimension Number | String the dimensionality of each coordinate, i.e. 2 or 3.

geojson-to-gml-3.geomToGml(geom, gmlId, params, gmlIds) ⇒ String

Translates any geojson geometry into GML 3.2.1

Kind: static method of geojson-to-gml-3
Returns: String - a valid gml string describing the input geojson geometry
Access: public

Param Type Description
geom Object a geojson geometry object
geom.coordinates Array the nested array of coordinates forming the geometry
geom.geometries Array.<Object> for a GeometryCollection only, the array of member geometry objects
gmlId String | Number the gml:id of the geometry
params object optional parameters
params.srsName String a string specifying the SRS
params.srsDimension String the dimensionality of each coordinate, i.e. 2 or 3.
gmlIds ?Array.<Number> | ?Array.<String> an array of number/string gml:ids of the member geometries of a multigeometry.

geojson-to-gml-3~allTypes : Object

a namespace to switch between geojson-handling functions by geojson.type

Kind: inner constant of geojson-to-gml-3

geojson-to-gml-3~orderCoords(coords) ⇒ Array.<Number>

reorder coordinates to lat, lng iff config.coordinateOrder is false.

Kind: inner method of geojson-to-gml-3
Returns: Array.<Number> - An array of coordinates in the correct order.

Param Type Description
coords Array.<Number> An array of coordinates, [lng, lat, ...etc]

geojson-to-gml-3~multi(name, memberName, geom, gmlId, params) ⇒ String

A handler to compile geometries to multigeometries

Kind: inner method of geojson-to-gml-3
Returns: String - a string containing gml describing the input multigeometry
Throws:

  • Error if a member geometry cannot be converted to gml
Param Type Description
name String the name of the target multigeometry
memberName String the gml:tag of each multigeometry member.
geom Array.<Object> | Array an array of geojson geometries
gmlId String | Number the gml:id of the multigeometry
params Params optional parameters. Omit gmlIds at your own risk, however.

geojson-to-gml-3~makeConverter(obj) ⇒ Object

A helper to de-camelcase this module's geometry conversion methods

Kind: inner method of geojson-to-gml-3
Returns: Object - a mapping of capitalized geometry types to converter functions

Param Type Description
obj Object a mapping of camelcase geometry types to converter functions

Example

makeConverter({lineString})
// returns {LineString: lineString}

geojson-to-gml-3~Params : Object

Optional parameters for conversion of geojson to gml geometries

Kind: inner typedef of geojson-to-gml-3
Properties

Name Type Description
params.srsName String as string specifying SRS, e.g. 'EPSG:4326'. Only applies to multigeometries.
params.gmlIds ?Array.<Number> | ?Array.<String> an array of number/string gml:ids of the member geometries.
params.srsDimension Number | String the dimensionality of each coordinate, i.e. 2 or 3.