Class: Proj::CrsInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/proj/crs_info.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth_name:, code:, name:, crs_type:, deprecated:, bbox_valid:, west_lon_degree:, south_lat_degree:, east_lon_degree:, north_lat_degree:, area_name:, projection_method_name:, celestial_body_name: nil) ⇒ CrsInfo

Returns a new instance of CrsInfo.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/proj/crs_info.rb', line 29

def initialize(auth_name:, code:, name:, crs_type:, deprecated:, bbox_valid:,
               west_lon_degree:, south_lat_degree:, east_lon_degree:, north_lat_degree:,
               area_name:, projection_method_name:, celestial_body_name: nil)
  @auth_name = auth_name
  @code = code
  @name = name
  @crs_type = crs_type
  @deprecated = deprecated
  @bbox_valid = bbox_valid
  @west_lon_degree = west_lon_degree
  @south_lat_degree = south_lat_degree
  @east_lon_degree = east_lon_degree
  @north_lat_degree = north_lat_degree
  @area_name = area_name
  @projection_method_name = projection_method_name
  @celestial_body_name = celestial_body_name
end

Instance Attribute Details

#area_nameObject (readonly)

Returns the value of attribute area_name.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def area_name
  @area_name
end

#auth_nameObject (readonly)

Returns the value of attribute auth_name.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def auth_name
  @auth_name
end

#bbox_validObject (readonly)

Returns the value of attribute bbox_valid.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def bbox_valid
  @bbox_valid
end

#celestial_body_nameObject (readonly)

Returns the value of attribute celestial_body_name.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def celestial_body_name
  @celestial_body_name
end

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def code
  @code
end

#crs_typeObject (readonly)

Returns the value of attribute crs_type.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def crs_type
  @crs_type
end

#deprecatedObject (readonly)

Returns the value of attribute deprecated.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def deprecated
  @deprecated
end

#east_lon_degreeObject (readonly)

Returns the value of attribute east_lon_degree.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def east_lon_degree
  @east_lon_degree
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def name
  @name
end

#north_lat_degreeObject (readonly)

Returns the value of attribute north_lat_degree.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def north_lat_degree
  @north_lat_degree
end

#projection_method_nameObject (readonly)

Returns the value of attribute projection_method_name.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def projection_method_name
  @projection_method_name
end

#south_lat_degreeObject (readonly)

Returns the value of attribute south_lat_degree.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def south_lat_degree
  @south_lat_degree
end

#west_lon_degreeObject (readonly)

Returns the value of attribute west_lon_degree.



4
5
6
# File 'lib/proj/crs_info.rb', line 4

def west_lon_degree
  @west_lon_degree
end

Class Method Details

.from_proj_crs_info(proj_crs_info) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/proj/crs_info.rb', line 8

def self.from_proj_crs_info(proj_crs_info)
  data = { auth_name: proj_crs_info[:auth_name],
           code: proj_crs_info[:code],
           name: proj_crs_info[:name],
           crs_type: proj_crs_info[:type],
           deprecated: proj_crs_info[:deprecated] == 1 ? true : false,
           bbox_valid: proj_crs_info[:bbox_valid] == 1 ? true : false,
           west_lon_degree: proj_crs_info[:west_lon_degree],
           south_lat_degree: proj_crs_info[:south_lat_degree],
           east_lon_degree: proj_crs_info[:east_lon_degree],
           north_lat_degree: proj_crs_info[:north_lat_degree],
           area_name: proj_crs_info[:area_name],
           projection_method_name: proj_crs_info[:projection_method_name]}

  if Api::PROJ_VERSION >= Gem::Version.new('8.1.0')
    data[:celestial_body_name] = proj_crs_info[:celestial_body_name]
  end

  new(**data)
end