server/api/validators/geojson

Methods

(static) bboxString() → {function}

Source:

Returns a ValDSL validator that checks whether a value is a well-formatted bounding box string.

A bounding box string is composed of 4 comma-separated numbers:

  • The first 2 numbers are the coordinates (longitude & latitude) of the bounding box's south-west corner.
  • The last 2 numbers are the coordinates (longitude & latitude) of the bounding box's north-east corner.
Returns:

A validator function.

Type
function

(static) point() → {function}

Source:

Returns a ValDSL validator that checks whether a value is a GeoJSON object of type Point.

const { point: validateGeoJsonPoint } = require('../validators/geojson');

this.validate(
  this.json('geometry'),
  validateGeoJsonPoint()
)
Returns:

A validator function.

Type
function