Class: RGeo::CoordSys::CS::CoordinateSystemFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/rgeo/coord_sys/cs/factories.rb

Overview

A class implementing the CS_CoordinateSystemFactory interface. It provides methods for building up complex objects from simpler objects or values.

Note that the methods of CS_CoordinateSystemFactory do not provide facilities for setting the authority. If you need to set authority values, use the create methods for the object classes themselves.

Instance Method Summary collapse

Instance Method Details

#create_compound_coordinate_system(name, head, tail) ⇒ Object

Create a CompoundCoordinateSystem from a name, and two constituent coordinate systems.



43
44
45
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 43

def create_compound_coordinate_system(name, head, tail)
  CompoundCoordinateSystem.create(name, head, tail)
end

#create_ellipsoid(name, semi_major_axis, semi_minor_axis, linear_unit) ⇒ Object

Create an Ellipsoid from a name, semi-major axis, and semi-minor axis. You can also provide a LinearUnit, but this is optional and may be set to nil.



51
52
53
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 51

def create_ellipsoid(name, semi_major_axis, semi_minor_axis, linear_unit)
  Ellipsoid.create_ellipsoid(name, semi_major_axis, semi_minor_axis, linear_unit)
end

#create_flattened_sphere(name, semi_major_axis, inverse_flattening, linear_unit) ⇒ Object

Create an Ellipsoid from a name, semi-major axis, and an inverse flattening factor. You can also provide a LinearUnit, but this is optional and may be set to nil.



59
60
61
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 59

def create_flattened_sphere(name, semi_major_axis, inverse_flattening, linear_unit)
  Ellipsoid.create_flattened_sphere(name, semi_major_axis, inverse_flattening, linear_unit)
end

#create_from_wkt(str) ⇒ Object

Create any object given the OGC WKT format. Raises Error::ParseError if a syntax error is encounterred.



66
67
68
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 66

def create_from_wkt(str)
  WKTParser.new(str).parse
end

#create_geographic_coordinate_system(name, angular_unit, horizontal_datum, prime_meridian, axis0, axis1) ⇒ Object

Create a GeographicCoordinateSystem, given a name, an AngularUnit, a HorizontalDatum, a PrimeMeridian, and two AxisInfo objects. The AxisInfo objects are optional and may be set to nil.



75
76
77
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 75

def create_geographic_coordinate_system(name, angular_unit, horizontal_datum, prime_meridian, axis0, axis1)
  GeographicCoordinateSystem.create(name, angular_unit, horizontal_datum, prime_meridian, axis0, axis1)
end

#create_horizontal_datum(name, horizontal_datum_type, ellipsoid, to_wgs84) ⇒ Object

Create a HorizontalDatum given a name, a horizontal datum type code, an Ellipsoid, and a WGS84ConversionInfo. The WGS84ConversionInfo is optional and may be set to nil.



83
84
85
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 83

def create_horizontal_datum(name, horizontal_datum_type, ellipsoid, to_wgs84)
  HorizontalDatum.create(name, horizontal_datum_type, ellipsoid, to_wgs84)
end

#create_local_coordinate_system(name, datum, unit, axes) ⇒ Object

Create a LocalCoordinateSystem given a name, a LocalDatum, a Unit, and an array of at least one AxisInfo.



90
91
92
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 90

def create_local_coordinate_system(name, datum, unit, axes)
  LocalCoordinateSystem.create(name, datum, unit, axes)
end

#create_local_datum(_name, local_datum_type) ⇒ Object

Create a LocalDatum given a name and a local datum type code.



96
97
98
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 96

def create_local_datum(_name, local_datum_type)
  LocalDatum.create(name, local_datum_type)
end

#create_prime_meridian(_name, angular_unit, longitude) ⇒ Object

Create a PrimeMeridian given a name, an AngularUnit, and a longitude offset.



103
104
105
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 103

def create_prime_meridian(_name, angular_unit, longitude)
  PrimeMeridian.create(name, angular_unit, longitude)
end

#create_projected_coordinate_system(name, gcs, projection, linear_unit, axis0, axis1) ⇒ Object

Create a ProjectedCoordinateSystem given a name, a GeographicCoordinateSystem, and Projection, a LinearUnit, and two AxisInfo objects. The AxisInfo objects are optional and may be set to nil.



112
113
114
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 112

def create_projected_coordinate_system(name, gcs, projection, linear_unit, axis0, axis1)
  ProjectedCoordinateSystem.create(name, gcs, projection, linear_unit, axis0, axis1)
end

#create_projection(name, wkt_projection_class, parameters) ⇒ Object

Create a Projection given a name, a projection class, and an array of ProjectionParameter.



119
120
121
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 119

def create_projection(name, wkt_projection_class, parameters)
  Projection.create(name, wkt_projection_class, parameters)
end

#create_vertical_coordinate_system(name, vertical_datum, vertical_unit, axis) ⇒ Object

Create a VerticalCoordinateSystem given a name, a VerticalDatum, a VerticalUnit, and an AxisInfo. The AxisInfo is optional and may be nil.



127
128
129
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 127

def create_vertical_coordinate_system(name, vertical_datum, vertical_unit, axis)
  VerticalCoordinateSystem.create(name, vertical_datum, vertical_unit, axis)
end

#create_vertical_datum(name, vertical_datum_type) ⇒ Object

Create a VerticalDatum given a name ane a datum type code.



133
134
135
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 133

def create_vertical_datum(name, vertical_datum_type)
  VerticalDatum.create(name, vertical_datum_type)
end