server/spec/fixtures/geojson

Test utilities to generate GeoJSON data.

Source:

Methods

(static) coordinates(dataopt) → {Array.<number>}

Source:

Generates a random pair of coordinates (longitude & latitude).

const geoJsonFixtures = require('../spec/fixtures/geojson');

geoJsonFixtures.coordinates();  // [ -76, 48 ]
Parameters:
Name Type Attributes Default Description
data object <optional>
{}

Custom coordinates data.

Properties
Name Type Attributes Description
bbox object <optional>

A bounding box within which the generated coordinates should be.

Properties
Name Type Description
southWest Array.<number>

A longitude/latitude pair indicating the south-west corner of the bounding box.

northEast Array.<number>

A longitude/latitude pair indicating the north-east corner of the bounding box.

Returns:

A GeoJSON coordinates pair.

Type
Array.<number>

(static) point(dataopt) → {object}

Source:

Generates a GeoJSON point with random coordinates.

const geoJsonFixtures = require('../spec/fixtures/geojson');

geoJsonFixtures.point();  // { type: 'Point', coordinates: [ -76, 48 ] }
geoJsonFixtures.point({ coordinates });  // { type: 'Point', coordinates: [ -76, 48 ] }
Parameters:
Name Type Attributes Default Description
data object <optional>
{}

Custom point data.

Properties
Name Type Attributes Description
bbox object <optional>

A bounding box within which the generated point should be.

Properties
Name Type Description
southWest Array.<number>

A longitude/latitude pair indicating the south-west corner of the bounding box.

northEast Array.<number>

A longitude/latitude pair indicating the north-east corner of the bounding box.

coordinates Array.<number> <optional>

The point's coordinates (longitude & latitude).

Returns:

A GeoJSON point.

Type
object