A library of functions to convert geojson to GML.
- geojson-to-gml-3
- static
- .config :
Object
- .point(coords, gmlId, params) ⇒
String
- .lineString(coords, gmlId, params) ⇒
String
- .linearRing(coords, gmlId, params) ⇒
String
- .polygon(coords, gmlId, params) ⇒
String
- .multiPoint(coords, gmlId, params) ⇒
String
- .multiLineString(coords, gmlId, params) ⇒
String
- .multiPolygon(coords, gmlId, params) ⇒
String
- .makeTranslator(obj)
- .geometryCollection(coords, gmlId, params) ⇒
String
- .geomToGml(geom, gmlId, params, gmlIds) ⇒
String
- .config :
- inner
- ~allTypes :
Object
- ~orderCoords(coords) ⇒
Array.<Number>
- ~multi(name, memberName, geom, gmlId, params) ⇒
String
- ~makeConverter(obj) ⇒
Object
- ~Params :
Object
- ~allTypes :
- static
Configuration for this module.
Kind: static constant of geojson-to-gml-3
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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]});
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. |
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. |
a namespace to switch between geojson-handling functions by geojson.type
Kind: inner constant of geojson-to-gml-3
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] |
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. |
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}
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. |