Method: Proj::Crs#initialize
- Defined in:
- lib/proj/crs.rb
#initialize(value, context = nil) ⇒ Crs
To create a coordinate system, you can use CRS codes, well-known text (WKT) strings or old-style Proj4 strings (which are deprecated).
Notice when using the old-style Proj4 string, the addition of the “+type=crs” value.
337 338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/proj/crs.rb', line 337 def initialize(value, context=nil) ptr = Api.proj_create(context || Context.current, value) if ptr.null? Error.check_object(self) end super(ptr, context) if Api.method_defined?(:proj_is_crs) && !Api.proj_is_crs(ptr) raise(Error, "Invalid crs definition. Proj created an instance of: #{self.proj_type}.") end end |