Method: Proj::Conversion#convert_to_other_method

Defined in:
lib/proj/conversion.rb

#convert_to_other_method(new_method_epsg_code: nil, new_method_name: nil) ⇒ Conversion

Return an equivalent projection. Currently implemented:

  • EPSG_CODE_METHOD_MERCATOR_VARIANT_A (1SP) to EPSG_CODE_METHOD_MERCATOR_VARIANT_B (2SP)

  • EPSG_CODE_METHOD_MERCATOR_VARIANT_B (2SP) to EPSG_CODE_METHOD_MERCATOR_VARIANT_A (1SP)

  • EPSG_CODE_METHOD_LAMBERT_CONIC_CONFORMAL_1SP to EPSG_CODE_METHOD_LAMBERT_CONIC_CONFORMAL_2SP

  • EPSG_CODE_METHOD_LAMBERT_CONIC_CONFORMAL_2SP to EPSG_CODE_METHOD_LAMBERT_CONIC_CONFORMAL_1SP

Parameters:

  • new_method_epsg_code (String) (defaults to: nil)

    EPSG code of the target method. Or nil in which case new_method_name must be specified.

  • new_method_name (String) (defaults to: nil)

    EPSG or PROJ target method name. Or nil in which case new_method_epsg_code must be specified

Returns:



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/proj/conversion.rb', line 79

def convert_to_other_method(new_method_epsg_code: nil, new_method_name: nil)
  ptr = Api.proj_convert_conversion_to_other_method(self.context, self,
                                                    new_method_epsg_code ? new_method_epsg_code: 0,
                                                    new_method_name)

  if ptr.null?
    Error.check_context(context)
  end

  self.class.create_object(ptr, context)
end