Method: Proj::CoordinateSystem.create

Defined in:
lib/proj/coordinate_system.rb

.create(cs_type, axes, context) ⇒ CoordinateSystem

Create a CoordinateSystem

Parameters:

  • context (Context)

    The context associated with the CoordinateSystem

  • cs_type (PJ_COORDINATE_SYSTEM_TYPE)

    Coordinate system type

  • axes (Array<PJ_AXIS_DESCRIPTION>)

    Array of Axes

Returns:



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/proj/coordinate_system.rb', line 13

def self.create(cs_type, axes, context)
  axes_ptr = FFI::MemoryPointer.new(Api::PJ_AXIS_DESCRIPTION, axes.size)
  axes.each_with_index do |axis, i|
    axis_description_target = Api::PJ_AXIS_DESCRIPTION.new(axes_ptr[i])
    axis_description_source = axis.to_description
    axis_description_target.to_ptr.__copy_from__(axis_description_source.to_ptr, Api::PJ_AXIS_DESCRIPTION.size)
  end

  pointer = Api.proj_create_cs(context, cs_type, axes.count, axes_ptr)
  Error.check_context(context)
  self.create_object(pointer, context)
end