Class: EMLGeoCoverage

EMLGeoCoverage()

A description of geographic coverage of a dataset, per the EML 2.1.1 metadata standard

Constructor

new EMLGeoCoverage()

Source:

Extends

  • Backbone.Model

Members

errorMessages :Object

The map of error keys to human-readable error messages to use for validation issues.
Type:
  • Object
Properties:
Name Type Description
default string When the error is not in this list
north string When the Northwest latitude is not in the valid range
east string When the Southeast longitude is not in the valid range
south string When the Southeast latitude is not in the valid range
west string When the Northwest longitude is not in the valid range
missing string When a long or lat coordinate is missing
description string When a description is missing
needPair string When there are no coordinate pairs
northSouthReversed string When the North latitude is less than the South latitude
crossesAntiMeridian string When the bounding box crosses the anti-meridian
Since:
  • 2.27.0
Source:

Methods

addSpace(msg, front) → {string}

Sometimes we'll need to add a space between error messages, but only if an error has already been triggered. Use addSpace to accomplish this.
Parameters:
Name Type Description
msg string The string that will be appended
front bool A flag that when set will append the whitespace to the front of 'msg'
Source:
Returns:
The string that was passed in, 'msg', with whitespace appended
Type
string

checkForPairs(status) → {bool}

Checks that there are either two or four coordinate values. If there aren't, it means that the user still needs to enter coordinates.
Parameters:
Name Type Description
status The current state of the coordinates
Source:
Returns:
True if there are pairs, false otherwise
Type
bool

formatXML()

See DataONEObject.formatXML()
Source:

generateStatusErrors(status) → {string}

Checks the status object for conditions that warrant an error message to the user. This is called during the validation processes (validate() and updateModel()) after the status object has been created by getCoordinateStatus().
Parameters:
Name Type Description
status The status object, holding the state of the coordinates
Source:
Returns:
Any errors that need to be displayed to the user
Type
string

getCoordinateStatus() → {array}

Generates an object that describes the current state of each latitude and longitude box. The status includes whether there is a value and if the value is valid.
Source:
Returns:
An array containing the current state of each coordinate box, including: value (the value of the coordinate converted to a number), isSet (whether the coordinate has a value), and isValid (whether the value is in the correct range)
Type
array

getErrorMessage(area) → {string}

Because the same error messages are used in a couple of different places, we centralize the strings and access here.
Parameters:
Name Type Description
area string Specifies the area that the error message belongs to. Browse through the switch statement to find the one you need.
Source:
Returns:
The error message
Type
string

getParentEML() → {EML211|false}

Climbs up the model hierarchy until it finds the EML model
Source:
Returns:
- Returns the EML 211 Model or false if not found
Type
EML211 | false

hasMissingPoint(status) → {bool}

Checks for any coordinates with missing counterparts.
Parameters:
Name Type Description
status The status of the coordinates
Source:
Returns:
True if there are missing coordinates, false otherwise
Type
bool

parse(objectDOM) → {Object}

Parses the objectDOM to populate this model with data.
Parameters:
Name Type Description
objectDOM Element The EML object element
Source:
Returns:
The EMLGeoCoverage data
Type
Object
Example
- Example input XML
<geographicCoverage scope="document">
  <geographicDescription>Rhine-Main-Observatory</geographicDescription>
  <boundingCoordinates>
    <westBoundingCoordinate>9.0005</westBoundingCoordinate>
    <eastBoundingCoordinate>9.0005</eastBoundingCoordinate>
    <northBoundingCoordinate>50.1600</northBoundingCoordinate>
    <southBoundingCoordinate>50.1600</southBoundingCoordinate>
  </boundingCoordinates>
</geographicCoverage>

serialize() → {string}

Converts this EMLGeoCoverage to XML
Source:
Returns:
The XML string
Type
string

trickleUpChange()

Apply the change event on the parent EML model
Source:

validate() → {string}

This grabs the various location elements and validates the user input. In the case of an error, we append an error string (errMsg) so that we display all of the messages at the same time. This validates the entire location row by adding extra checks for a description and for coordinate pairs
Source:
Returns:
The error messages that the user will see
Type
string

validateCoordinate(value, min, max) → {bool}

Validate a coordinate String by making sure it can be coerced into a number and is within the given bounds. Note: Min and max are inclusive
Parameters:
Name Type Description
value string The value of the edit area that will be validated
min The minimum value that 'value' can be
max The maximum value that 'value' can be
Source:
Returns:
True if the validation passed, otherwise false
Type
bool