Class: Datacite::Mapping::GeoLocation

Inherits:
Object
  • Object
show all
Includes:
XML::Mapping
Defined in:
lib/datacite/mapping/geo_location.rb

Overview

A location at which the data was gathered or about which the data is focused, in the form of a latitude-longitude point, a latitude-longitude quadrangle, and/or a place name.

Note: Due to a quirk of the DataCite spec, it is possible for a GeoLocation to be empty, with none of these present.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(point: nil, box: nil, place: nil, polygon: nil) ⇒ GeoLocation

Initializes a new Datacite::Mapping::GeoLocation

Parameters:

  • point (GeoLocationPoint, nil) (defaults to: nil)

    the latitude and longitude at which the data was gathered or about which the data is focused.

  • box (GeoLocationBox, nil) (defaults to: nil)

    the latitude-longitude quadrangle containing the area where the data was gathered or about which the data is focused.

  • place (String, nil) (defaults to: nil)

    the spatial region or named place where the data was gathered or about which the data is focused.

  • polygon (GeoLocationPolygon, nil) (defaults to: nil)

    a drawn polygon area containing the area where the data was gathered or about which the data is focused.



22
23
24
25
26
27
# File 'lib/datacite/mapping/geo_location.rb', line 22

def initialize(point: nil, box: nil, place: nil, polygon: nil)
  self.point = point
  self.box = box
  self.place = place
  self.polygon = polygon
end

Instance Attribute Details

#boxGeoLocationBox?

Returns the latitude-longitude quadrangle containing the area where the data was gathered or about which the data is focused.

Returns:

  • (GeoLocationBox, nil)

    the latitude-longitude quadrangle containing the area where the data was gathered or about which the data is focused.



45
# File 'lib/datacite/mapping/geo_location.rb', line 45

geo_location_box_node :box, 'geoLocationBox', default_value: nil

#placeString?

Returns the spatial region or named place where the data was gathered or about which the data is focused.

Returns:

  • (String, nil)

    the spatial region or named place where the data was gathered or about which the data is focused.



53
# File 'lib/datacite/mapping/geo_location.rb', line 53

text_node :place, 'geoLocationPlace', default_value: nil

#pointGeoLocationPoint?

Returns the latitude and longitude at which the data was gathered or about which the data is focused.

Returns:

  • (GeoLocationPoint, nil)

    the latitude and longitude at which the data was gathered or about which the data is focused.



41
# File 'lib/datacite/mapping/geo_location.rb', line 41

geo_location_point_node :point, 'geoLocationPoint', default_value: nil

Instance Method Details

#location?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/datacite/mapping/geo_location.rb', line 33

def location?
  point || box || place || polygon
end