Class: RGeo::CoordSys::CS::Info

Inherits:
Base
  • Object
show all
Defined in:
lib/rgeo/coord_sys/cs/entities.rb

Overview

OGC spec description

A base interface for metadata applicable to coordinate system objects.

The metadata items “Abbreviation”, “Alias”, “Authority”, “AuthorityCode”, “Name” and “Remarks” were specified in the Simple Features interfaces, so they have been kept here.

This specification does not dictate what the contents of these items should be. However, the following guidelines are suggested:

When CS_CoordinateSystemAuthorityFactory is used to create an object, the “Authority” and “AuthorityCode” values should be set to the authority name of the factory object, and the authority code supplied by the client, respectively. The other values may or may not be set. (If the authority is EPSG, the implementer may consider using the corresponding metadata values in the EPSG tables.)

When CS_CoordinateSystemFactory creates an object, the “Name” should be set to the value supplied by the client. All of the other metadata items should be left empty.

Notes

This is a non-instantiable abstract class.

Most subclasses will have a set of optional parameters in their “create” method to set the metadata fields. These parameters are, in order:

  • authority: authority name

  • authority_code: authority-specific identification code

  • abbreviation: an abbreviation

  • alias: an alias

  • remarks: provider-supplied remarks.

  • extensions: a hash of extension keys and values

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#encode_with, #eql?, #hash, #init_with, #inspect, #marshal_dump, #marshal_load, #to_s, #to_wkt

Constructor Details

#initialize(name, authority = nil, authority_code = nil, abbreviation = nil, init_alias = nil, remarks = nil, extensions = nil) ⇒ Info

Returns a new instance of Info.



431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 431

def initialize(name, authority = nil, authority_code = nil, abbreviation = nil, init_alias = nil,
               remarks = nil, extensions = nil) # :nodoc:
  super()
  @name = name
  @authority = authority ? authority.to_s : nil
  @authority_code = authority_code ? authority_code.to_s : nil
  @abbreviation = abbreviation ? abbreviation.to_s : nil
  @alias = init_alias ? init_alias.to_s : nil
  @remarks = remarks ? remarks.to_s : nil
  @extensions = {}
  extensions&.each { |k, v| @extensions[k.to_s] = v.to_s }
end

Instance Attribute Details

#abbreviationObject (readonly)

Gets the abbreviation.



445
446
447
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 445

def abbreviation
  @abbreviation
end

#aliasObject (readonly)

Gets the alias.



448
449
450
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 448

def alias
  @alias
end

#authorityObject (readonly)

Gets the authority name. An Authority is an organization that maintains definitions of Authority Codes. For example the European Petroleum Survey Group (EPSG) maintains a database of coordinate systems, and other spatial referencing objects, where each object has a code number ID. For example, the EPSG code for a WGS84 Lat/Lon coordinate system is “4326”.



457
458
459
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 457

def authority
  @authority
end

#authority_codeObject (readonly)

Gets the authority-specific identification code. The AuthorityCode is a compact string defined by an Authority to reference a particular spatial reference object. For example, the European Survey Group (EPSG) authority uses 32 bit integers to reference coordinate systems, so all their code strings will consist of a few digits. The EPSG code for WGS84 Lat/Lon is “4326”.



466
467
468
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 466

def authority_code
  @authority_code
end

#nameObject (readonly)

Gets the name.



469
470
471
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 469

def name
  @name
end

#remarksObject (readonly)

Gets the provider-supplied remarks.



472
473
474
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 472

def remarks
  @remarks
end

Instance Method Details

#extension(key) ⇒ Object

Gets the value of a keyed extension. This is not part of the OGC spec, but it is supported because some coordinate system databases (such as the spatial_ref_sys table for PostGIS 2.0) include it.



478
479
480
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 478

def extension(key)
  @extensions[key.to_s]
end