class RGeo::CoordSys::SRSDatabase::Entry

An entry in a spatial reference system database. Every entry has an identifier, but all the other attributes are optional and may or may not be present depending on the database.

Attributes

authority[R]

The authority name, if present. Example: “epsg”.

authority_code[R]

The authority code, e.g. an EPSG code.

coord_sys[R]

The CS::CoordinateSystem object.

description[R]

A human-readable description for this coordinate system.

identifier[R]

The database key or identifier.

name[R]

A human-readable name for this coordinate system.

proj4[R]

The Proj4 object.

Public Class Methods

new(ident_, data_={}) click to toggle source

Create an entry. You must provide an identifier, which may be numeric or a string. The data hash should contain any other attributes, keyed by symbol.

Some attribute inputs have special behaviors:

:coord_sys

You can pass a CS coordinate system object, or a string in WKT format.

:proj4

You can pass a Proj4 object, or a proj4-format string.

:name

If the name is not provided directly, it is taken from the coord_sys.

:authority

If the authority name is not provided directly, it is taken from the coord_sys.

:authority_code

If the authority code is not provided directly, it is taken from the coord_sys.

# File lib/rgeo/coord_sys/srs_database/interface.rb, line 110
def initialize(ident_, data_={})
  @identifier = ident_
  @authority = data_[:authority]
  @authority_code = data_[:authority_code]
  @name = data_[:name]
  @description = data_[:description]
  @coord_sys = data_[:coord_sys]
  if @coord_sys.kind_of?(::String)
    @coord_sys = CS.create_from_wkt(@coord_sys)
  end
  @proj4 = data_[:proj4]
  if Proj4.supported?
    if @proj4.kind_of?(::String) || @proj4.kind_of?(::Hash)
      @proj4 = Proj4.create(@proj4)
    end
  else
    @proj4 = nil
  end
  if @coord_sys
    @name = @coord_sys.name unless @name
    @authority = @coord_sys.authority unless @authority
    @authority_code = @coord_sys.authority unless @authority_code
  end
end