module OGR::SpatialReferenceMixins::Initializers::ClassMethods

Public Instance Methods

build_spatial_ref(spatial_reference_or_wkt = nil) { |c_pointer| ... } click to toggle source

@return [OGR::SpatialReference] @raise [OGR::Failure]

# File lib/ogr/extensions/spatial_reference/initializers.rb, line 123
def build_spatial_ref(spatial_reference_or_wkt = nil)
  object = new(spatial_reference_or_wkt)
  ogr_err = yield object.c_pointer

  OGR::ErrorHandling.handle_ogr_err("Unable to build SpatialReference") do
    ogr_err
  end

  object
end
new_from_epsg(code) click to toggle source

@param code [Integer] @return [OGR::SpatialReference]

# File lib/ogr/extensions/spatial_reference/initializers.rb, line 15
def new_from_epsg(code)
  srs = new
  srs.import_from_epsg(code)

  srs
end
new_from_epsga(code) click to toggle source

@param code [Integer] @return [OGR::SpatialReference]

# File lib/ogr/extensions/spatial_reference/initializers.rb, line 24
def new_from_epsga(code)
  srs = new
  srs.import_from_epsga(code)

  srs
end
new_from_erm(projection_name, datum_name, linear_unit_name) click to toggle source

@param projection_name [String] I.e. “NUTM11” or “GEOGRAPHIC”. @param datum_name [String] I.e. “NAD83”. @param linear_unit_name [String] Plural form of linear units, i.e. “FEET”. @return [OGR::SpatialReference]

# File lib/ogr/extensions/spatial_reference/initializers.rb, line 35
def new_from_erm(projection_name, datum_name, linear_unit_name)
  srs = new
  srs.import_from_erm(projection_name, datum_name, linear_unit_name)

  srs
end
new_from_esri(prj_text) click to toggle source

@param prj_text [Array<String>] @return [OGR::SpatialReference]

# File lib/ogr/extensions/spatial_reference/initializers.rb, line 44
def new_from_esri(prj_text)
  srs = new
  srs.import_from_esri(prj_text)

  srs
end
new_from_mapinfo(coord_sys) click to toggle source

@param coord_sys [String] The Mapinfo style CoordSys definition string. @return [OGR::SpatialReference]

# File lib/ogr/extensions/spatial_reference/initializers.rb, line 53
def new_from_mapinfo(coord_sys)
  srs = new
  srs.import_from_mapinfo(coord_sys)

  srs
end
new_from_pci(proj, units, *proj_params) click to toggle source

@param proj [String] @param units [String] @param proj_params [Array<String>] @return [OGR::SpatialReference]

# File lib/ogr/extensions/spatial_reference/initializers.rb, line 64
def new_from_pci(proj, units, *proj_params)
  srs = new
  srs.import_from_pci(proj, units, *proj_params)

  srs
end
new_from_proj4(proj4) click to toggle source

@param proj4 [String] @return [OGR::SpatialReference]

# File lib/ogr/extensions/spatial_reference/initializers.rb, line 73
def new_from_proj4(proj4)
  srs = new
  srs.import_from_proj4(proj4)

  srs
end
new_from_url(url) click to toggle source

@param url [String] URL to fetch the spatial reference from. @return [OGR::SpatialReference]

# File lib/ogr/extensions/spatial_reference/initializers.rb, line 82
def new_from_url(url)
  srs = new
  srs.import_from_url(url)

  srs
end
new_from_usgs(projection_system_code, zone, datum, *proj_params) click to toggle source

@param projection_system_code @return [OGR::SpatialReference]

# File lib/ogr/extensions/spatial_reference/initializers.rb, line 91
def new_from_usgs(projection_system_code, zone, datum, *proj_params)
  srs = new
  srs.import_from_usgs(projection_system_code, zone, datum, *proj_params)

  srs
end
new_from_wkt(wkt) click to toggle source

This wipes the existing SRS definition and reassigns it based on the contents of wkt.

@param wkt [String] @return [OGR::SpatialReference]

# File lib/ogr/extensions/spatial_reference/initializers.rb, line 103
def new_from_wkt(wkt)
  srs = new
  srs.import_from_wkt(wkt)

  srs
end
new_from_xml(xml) click to toggle source

Use for importing a GML coordinate system.

@param xml [String] @return [OGR::SpatialReference]

# File lib/ogr/extensions/spatial_reference/initializers.rb, line 114
def new_from_xml(xml)
  srs = new
  srs.import_from_xml(xml)

  srs
end