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.


45
46
47
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 45

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.


53
54
55
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 53

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.


61
62
63
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 61

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.


68
69
70
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 68

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.


77
78
79
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 77

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.


85
86
87
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 85

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.


92
93
94
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 92

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.


98
99
100
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 98

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.


105
106
107
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 105

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.


114
115
116
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 114

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.


121
122
123
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 121

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.


129
130
131
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 129

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.


135
136
137
# File 'lib/rgeo/coord_sys/cs/factories.rb', line 135

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