module OGR::SpatialReferenceMixins::CoordinateSystemGetterSetters

Public Instance Methods

authority_code(target_key = nil) click to toggle source

@param target_key [String] The partial or complete path to the node to get

an authority from ("PROJCS", "GEOCS", "GEOCS|UNIT").  Leave empty to
search at the root element.

@return [String, nil]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 208
def authority_code(target_key = nil)
  code, ptr = FFI::OGR::SRSAPI.OSRGetAuthorityCode(@c_pointer, target_key)
  ptr.autorelease = false

  code
end
authority_name(target_key = nil) click to toggle source

@param target_key [String] The partial or complete path to the node to get

an authority from ("PROJCS", "GEOCS", "GEOCS|UNIT").  Leave empty to
search at the root element.

@return [String, nil]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 219
def authority_name(target_key = nil)
  name, ptr = FFI::OGR::SRSAPI.OSRGetAuthorityName(@c_pointer, target_key)
  ptr.autorelease = false

  name
end
axis(axis_number, target_key) click to toggle source

@param axis_number [Integer] The Axis to query (0, 1, or 2) @param target_key [String] ‘GEOGCS’ or ‘PROJCS’. @return [String, nil]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 322
def axis(axis_number, target_key)
  axis_orientation_ptr = FFI::MemoryPointer.new(:int)

  name = FFI::OGR::SRSAPI.OSRGetAxis(@c_pointer, target_key, axis_number, axis_orientation_ptr)
  ao_value = axis_orientation_ptr.read_int

  { name: name, orientation: FFI::OGR::SRSAPI::AxisOrientation[ao_value] }
end
geoc_cs=(name)
Alias for: set_geoc_cs
local_cs=(name)
Alias for: set_local_cs
normalized_projection_parameter(name, default_value = 0.0) click to toggle source

@param name [String] Name of the parameter to fetch; must be from the

set of SRS_PP codes in ogr_srs_api.h.

@param default_value [Float] The value to return if the parameter

doesn't exist.
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 276
def normalized_projection_parameter(name, default_value = 0.0)
  FFI::OGR::SRSAPI.OSRGetNormProjParm(@c_pointer, name, default_value, nil)
end
proj_cs=(name)
Alias for: set_proj_cs
projection=(projection_name)
Alias for: set_projection
projection_parameter(name, default_value = 0.0) click to toggle source

@param name [String] @param default_value [Float] The value to return if the parameter

doesn't exist.

@raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 248
def projection_parameter(name, default_value = 0.0)
  value = default_value

  OGR::ErrorHandling.handle_ogr_err("Unable to get projection parameter '#{name}'") do
    ogr_err_ptr = FFI::MemoryPointer.new(:int)
    value = FFI::OGR::SRSAPI.OSRGetProjParm(@c_pointer, name, default_value, ogr_err_ptr)
    ogr_err_int = ogr_err_ptr.null? ? 0 : ogr_err_ptr.read_int
    FFI::OGR::Core::Err[ogr_err_int]
  end

  value
end
semi_major(return_wgs84_on_nil: false) click to toggle source

@param return_wgs84_on_nil [Boolean] The C-API gives you the option to

return the value for constant +SRS_WGS84_SEMIMAJOR+ (6378137.0) if no
semi-major is found.  If set to +true+, this will return that value if
the semi-major isn't found.

@return [Float]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 151
def semi_major(return_wgs84_on_nil: false)
  err_ptr = FFI::MemoryPointer.new(:int)
  value = FFI::OGR::SRSAPI.OSRGetSemiMajor(@c_pointer, err_ptr)
  ogr_err = FFI::OGR::Core::Err[err_ptr.read_int]
  wgs84_value = return_wgs84_on_nil ? value : nil

  ogr_err == :OGRERR_FAILURE ? wgs84_value : value
end
semi_minor(return_wgs84_on_nil: false) click to toggle source

@param return_wgs84_on_nil [Boolean] The C-API gives you the option to

return the value for constant +SRS_WGS84_SEMIMAJOR+ (6378137.0) if no
semi-major is found.  If set to +true+, this will return that value if
the semi-major isn't found.

@return [Float]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 165
def semi_minor(return_wgs84_on_nil: false)
  err_ptr = FFI::MemoryPointer.new(:int)
  value = FFI::OGR::SRSAPI.OSRGetSemiMinor(@c_pointer, err_ptr)
  ogr_err = FFI::OGR::Core::Err[err_ptr.read_int]
  wgs84_value = return_wgs84_on_nil ? value : nil

  ogr_err == :OGRERR_FAILURE ? wgs84_value : value
end
set_acea()
set_ae() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 336
def set_ae
  raise NotImplementedError
end
set_albers_conic_equal_area() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 331
def set_albers_conic_equal_area
  raise NotImplementedError
end
Also aliased as: set_acea
set_authority(target_key, authority, code) click to toggle source

@param target_key [String] The partial or complete path to the node to

set an authority on ("PROJCS", "GEOGCS|UNIT").

@param authority [String] I.e. “EPSG”. @param code [Integer] Code value for the authority. @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 193
def set_authority(target_key, authority, code)
  OGR::ErrorHandling.handle_ogr_err("Unable to set authority: '#{target_key}', '#{authority}', '#{code}'") do
    FFI::OGR::SRSAPI.OSRSetAuthority(
      @c_pointer,
      target_key,
      authority,
      code
    )
  end
end
set_bonne() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 340
def set_bonne
  raise NotImplementedError
end
set_cea() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 344
def set_cea
  raise NotImplementedError
end
set_compound_cs(name, horizontal_spatial_ref, vertical_spatial_ref) click to toggle source

@param name [String] @param horizontal_spatial_ref [OGR::SpatialReference] (a PROJCS or GEOGCS) @param vertical_spatial_ref [OGR::SpatialReference] (a VERT_CS) @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 94
def set_compound_cs(name, horizontal_spatial_ref, vertical_spatial_ref)
  horizontal_spatial_ref_ptr = GDAL._pointer(OGR::SpatialReference, horizontal_spatial_ref)
  vertical_spatial_ref_ptr = GDAL._pointer(OGR::SpatialReference, vertical_spatial_ref)

  OGR::ErrorHandling.handle_ogr_err("Unable to set compound CS '#{name}'") do
    FFI::OGR::SRSAPI.OSRSetCompoundCS(
      @c_pointer,
      name,
      horizontal_spatial_ref_ptr,
      vertical_spatial_ref_ptr
    )
  end
end
set_cs() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 348
def set_cs
  raise NotImplementedError
end
set_ec() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 352
def set_ec
  raise NotImplementedError
end
set_eckert() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 356
def set_eckert
  raise NotImplementedError
end
set_eckert_iv() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 360
def set_eckert_iv
  raise NotImplementedError
end
set_eckert_vi() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 364
def set_eckert_vi
  raise NotImplementedError
end
set_equirectangular() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 368
def set_equirectangular
  raise NotImplementedError
end
set_equirectangular2() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 372
def set_equirectangular2
  raise NotImplementedError
end
set_from_user_input(definition) click to toggle source

@param definition [String] @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 52
def set_from_user_input(definition) # rubocop:disable Naming/AccessorMethodName
  OGR::ErrorHandling.handle_ogr_err("Invalid projection info given.") do
    FFI::OGR::SRSAPI.OSRSetFromUserInput(@c_pointer, definition)
  end
end
set_gauss_schreiber_transverse_mercator() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 392
def set_gauss_schreiber_transverse_mercator
  raise NotImplementedError
end
set_gc() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 376
def set_gc
  raise NotImplementedError
end
set_geoc_cs(name) click to toggle source

Set the user-visible PROJCS name.

@param name [String] @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 32
def set_geoc_cs(name) # rubocop:disable Naming/AccessorMethodName
  OGR::ErrorHandling.handle_ogr_err("Unable to set GEOCCS to '#{name}'") do
    FFI::OGR::SRSAPI.OSRSetGeocCS(@c_pointer, name)
  end
end
Also aliased as: geoc_cs=
set_geog_cs(geog_name, datum_name, spheroid_name, semi_major, spheroid_inverse_flattening, prime_meridian, offset, angular_unit_label, transform_to_radians) click to toggle source

Set the user-visible GEOGCS name.

@param [String] geog_name @param [String] datum_name @param [String] spheroid_name @param [Float] semi_major @param [Float] spheroid_inverse_flattening @param [String] prime_meridian @param [Double] offset @param [String] angular_unit_label @param [Float] transform_to_radians @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 120
def set_geog_cs(geog_name, datum_name, spheroid_name, semi_major, spheroid_inverse_flattening,
  prime_meridian, offset, angular_unit_label, transform_to_radians)
  OGR::ErrorHandling.handle_ogr_err("Unable to set GEOGCS '#{name}'") do
    FFI::OGR::SRSAPI.OSRSetGeogCS(
      @c_pointer,
      geog_name, datum_name, spheroid_name,
      semi_major, spheroid_inverse_flattening,
      prime_meridian, offset,
      angular_unit_label, transform_to_radians
    )
  end
end
set_geos() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 388
def set_geos
  raise NotImplementedError
end
set_gh() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 380
def set_gh
  raise NotImplementedError
end
set_gnomonic() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 396
def set_gnomonic
  raise NotImplementedError
end
set_hom() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 404
def set_hom
  raise NotImplementedError
end
set_hom_2_pno() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 408
def set_hom_2_pno
  raise NotImplementedError
end
set_igh() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 384
def set_igh
  raise NotImplementedError
end
set_iwm_polyconic() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 412
def set_iwm_polyconic
  raise NotImplementedError
end
set_krovak() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 416
def set_krovak
  raise NotImplementedError
end
set_laea() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 420
def set_laea
  raise NotImplementedError
end
set_lcc() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 424
def set_lcc
  raise NotImplementedError
end
set_lcc_1sp() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 428
def set_lcc_1sp
  raise NotImplementedError
end
set_lccb() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 432
def set_lccb
  raise NotImplementedError
end
set_local_cs(name) click to toggle source

Set the user-visible LOCAL_CS name.

@param name [String] @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 10
def set_local_cs(name) # rubocop:disable Naming/AccessorMethodName
  OGR::ErrorHandling.handle_ogr_err("Unable to set LOCAL_CS to '#{name}'") do
    FFI::OGR::SRSAPI.OSRSetLocalCS(@c_pointer, name)
  end
end
Also aliased as: local_cs=
set_mc() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 436
def set_mc
  raise NotImplementedError
end
set_mercator() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 440
def set_mercator
  raise NotImplementedError
end
set_mollweide() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 444
def set_mollweide
  raise NotImplementedError
end
set_normalized_projection_parameter(param_name, value) click to toggle source

@param param_name [String] @param value [Float] @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 264
def set_normalized_projection_parameter(param_name, value)
  msg = "Unable to set normalized projection parameter '#{param_name}' to '#{value}'"

  OGR::ErrorHandling.handle_ogr_err(msg) do
    FFI::OGR::SRSAPI.OSRSetNormProjParm(@c_pointer, param_name, value)
  end
end
set_nzmg() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 448
def set_nzmg
  raise NotImplementedError
end
set_om() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 400
def set_om
  raise NotImplementedError
end
set_orthographic() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 456
def set_orthographic
  raise NotImplementedError
end
set_os() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 452
def set_os
  raise NotImplementedError
end
set_polyconic() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 460
def set_polyconic
  raise NotImplementedError
end
set_proj_cs(name) click to toggle source

Set the user-visible PROJCS name.

@param name [String] @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 21
def set_proj_cs(name) # rubocop:disable Naming/AccessorMethodName
  OGR::ErrorHandling.handle_ogr_err("Unable to set PROJCS to '#{name}'") do
    FFI::OGR::SRSAPI.OSRSetProjCS(@c_pointer, name)
  end
end
Also aliased as: proj_cs=
set_projection(projection_name) click to toggle source

@param projection_name [String] @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 228
def set_projection(projection_name) # rubocop:disable Naming/AccessorMethodName
  OGR::ErrorHandling.handle_ogr_err("Unable to set projection to '#{projection_name}'") do
    FFI::OGR::SRSAPI.OSRSetProjection(@c_pointer, projection_name)
  end
end
Also aliased as: projection=
set_projection_parameter(param_name, value) click to toggle source

@param param_name [String] @param value [Float] @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 238
def set_projection_parameter(param_name, value)
  OGR::ErrorHandling.handle_ogr_err("Unable to set projection parameter '#{param_name}' to #{value}") do
    FFI::OGR::SRSAPI.OSRSetProjParm(@c_pointer, param_name, value)
  end
end
set_ps() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 464
def set_ps
  raise NotImplementedError
end
set_qsc() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 525
def set_qsc
  raise NotImplementedError
end
set_robinson() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 468
def set_robinson
  raise NotImplementedError
end
set_sinusoidal() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 472
def set_sinusoidal
  raise NotImplementedError
end
set_soc() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 480
def set_soc
  raise NotImplementedError
end
set_state_plane(zone, override_unit_label = nil, override_unit_transform = 0.0, nad83: true) click to toggle source

@param zone [Integer] State plane zone number (USGS numbering scheme). @param nad83 [Boolean] Use NAD83 zone definition or not. @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 307
def set_state_plane(zone, override_unit_label = nil, override_unit_transform = 0.0, nad83: true)
  OGR::ErrorHandling.handle_ogr_err("Unable to set state plane to zone #{zone}") do
    FFI::OGR::SRSAPI.OSRSetStatePlaneWithUnits(
      @c_pointer,
      zone,
      nad83,
      override_unit_label,
      override_unit_transform
    )
  end
end
set_stereographic() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 476
def set_stereographic
  raise NotImplementedError
end
set_tm(center_lat, center_long, scale, false_easting, false_northing)
set_tm_variant() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 505
def set_tm_variant
  raise NotImplementedError
end
set_tmg() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 509
def set_tmg
  raise NotImplementedError
end
set_tmso() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 513
def set_tmso
  raise NotImplementedError
end
set_towgs84(x_distance: nil, y_distance: nil, z_distance: 0.0, x_rotation: 0.0, y_rotation: 0.0, z_rotation: 0.0, scaling_factor: 0.0) click to toggle source

@param x_distance [Float] (In meters.) @param y_distance [Float] (In meters.) @param z_distance [Float] (In meters.) @param x_rotation [Float] (In arc seconds.) @param y_rotation [Float] (In arc seconds.) @param z_rotation [Float] (In arc seconds.) @param scaling_factor [Float] (In parts-per-million.) @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 78
def set_towgs84(x_distance: nil, y_distance: nil, z_distance: 0.0,
  x_rotation: 0.0, y_rotation: 0.0, z_rotation: 0.0, scaling_factor: 0.0)
  OGR::ErrorHandling.handle_ogr_err("No existing DATUM node") do
    FFI::OGR::SRSAPI.OSRSetTOWGS84(
      @c_pointer,
      x_distance, y_distance, z_distance,
      x_rotation, y_rotation, z_rotation,
      scaling_factor
    )
  end
end
set_transverse_mercator(center_lat, center_long, scale, false_easting, false_northing) click to toggle source

@param center_lat [Float] @param center_long [Float] @param scale [Float] @param false_easting [Float] @param false_northing [Float] @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 490
def set_transverse_mercator(center_lat, center_long, scale, false_easting, false_northing)
  msg = "Unable to set transverse mercator: " \
        "#{center_lat}, #{center_long}, #{scale}, #{false_easting}, #{false_northing}"

  OGR::ErrorHandling.handle_ogr_err(msg) do
    FFI::OGR::SRSAPI.OSRSetTM(
      @c_pointer,
      center_lat, center_long,
      scale,
      false_easting, false_northing
    )
  end
end
Also aliased as: set_tm
set_utm(zone, north: true) click to toggle source

@param zone [Integer] @param north [Boolean] True for northern hemisphere, false for southern. @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 283
def set_utm(zone, north: true)
  OGR::ErrorHandling.handle_ogr_err("Unable to set UTM to zome #{zone} (north: #{north})") do
    FFI::OGR::SRSAPI.OSRSetUTM(@c_pointer, zone, north)
  end
end
set_vdg() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 517
def set_vdg
  raise NotImplementedError
end
set_vert_cs(name, datum_name, datum_type) click to toggle source

Set the vertical coordinate system.

@param name [String] User-visible name of the CS. @param datum_name [String] User-visible name of the datum. It’s helpful

to have this match the EPSG name.

@param datum_type [Integer] The OGC datum type, usually 2005. @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 140
def set_vert_cs(name, datum_name, datum_type)
  OGR::ErrorHandling.handle_ogr_err("Unable to set vertical CS '#{name}'") do
    FFI::OGR::SRSAPI.OSRSetVertCS(@c_pointer, name, datum_name, datum_type)
  end
end
set_wagner() click to toggle source
# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 521
def set_wagner
  raise NotImplementedError
end
set_well_known_geog_cs(name) click to toggle source

Set the GEOGCS based on a well-known name.

@param name [String] @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 43
def set_well_known_geog_cs(name) # rubocop:disable Naming/AccessorMethodName
  OGR::ErrorHandling.handle_ogr_err("Unable to set GEOGCS to '#{name}'") do
    FFI::OGR::SRSAPI.OSRSetWellKnownGeogCS(@c_pointer, name)
  end
end
Also aliased as: well_known_geog_cs=
spheroid_inverse_flattening(return_wgs84_on_nil: false) click to toggle source

@param return_wgs84_on_nil [Boolean] The C-API gives you the option to

return the value for constant +SRS_WGS84_INVFLATTENING+ (298.257223563)
if no semi-major is found.  If set to +true+, this will return that
value if the semi-major isn't found.

@return [Float]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 179
def spheroid_inverse_flattening(return_wgs84_on_nil: false)
  err_ptr = FFI::MemoryPointer.new(:int)
  value = FFI::OGR::SRSAPI.OSRGetInvFlattening(@c_pointer, err_ptr)
  ogr_err = FFI::OGR::Core::Err[err_ptr.read_int]
  wgs84_value = return_wgs84_on_nil ? value : nil

  ogr_err == :OGRERR_FAILURE ? wgs84_value : value
end
towgs84() click to toggle source

@return [Array<Float>] @raise [OGR::Failure]

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 60
def towgs84
  coefficients = FFI::MemoryPointer.new(:double, 7)

  OGR::ErrorHandling.handle_ogr_err("No TOWGS84 node available") do
    FFI::OGR::SRSAPI.OSRGetTOWGS84(@c_pointer, coefficients, 7)
  end

  coefficients.get_array_of_double(0, 7)
end
utm_zone(hemisphere = :north) click to toggle source

@param hemisphere [Symbol] :north or :south. @return [Integer] The zone, or 0 if this isn’t a UTM definition.

# File lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb, line 291
def utm_zone(hemisphere = :north)
  north =
    case hemisphere
    when :north then 1
    when :south then 0
    else raise "Unknown hemisphere type #{hemisphere}. Please choose :north or :south."
    end
  north_ptr = FFI::MemoryPointer.new(:bool)
  north_ptr.write_bytes(north.to_s)

  FFI::OGR::SRSAPI.OSRGetUTMZone(@c_pointer, north_ptr)
end
well_known_geog_cs=(name)