Method: Proj::Conversion#initialize
- Defined in:
- lib/proj/conversion.rb
#initialize(value, context = nil) ⇒ Conversion
Instantiates an conversion from a string. The string can be:
-
proj-string,
-
WKT string,
-
object code (like “EPSG:4326”, “urn:ogc:def:crs:EPSG::4326”, “urn:ogc:def:coordinateOperation:EPSG::1671”),
-
Object name. e.g “WGS 84”, “WGS 84 / UTM zone 31N”. In that case as uniqueness is not guaranteed, heuristics are applied to determine the appropriate best match.
-
OGC URN combining references for compound coordinate reference systems (e.g “urn:ogc:def:crs,crs:EPSG::2393,crs:EPSG::5717” or custom abbreviated syntax “EPSG:2393+5717”),
-
OGC URN combining references for concatenated operations (e.g. “urn:ogc:def:coordinateOperation,coordinateOperation:EPSG::3895,coordinateOperation:EPSG::1618”)
-
PROJJSON string. The jsonschema is at proj.org/schemas/v0.4/projjson.schema.json (added in 6.2)
-
compound CRS made from two object names separated with “ + ”. e.g. “WGS 84 + EGM96 height” (added in 7.1)
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/proj/conversion.rb', line 54 def initialize(value, context=nil) context ||= Context.current ptr = Api.proj_create(context, value) if ptr.null? Error.check_context(context) end if Api.method_defined?(:proj_is_crs) && Api.proj_is_crs(ptr) raise(Error, "Invalid conversion. Proj created an instance of: #{self.proj_type}.") end super(ptr, context) end |