class Geos::GeoJSONReader

Attributes

ptr[R]

Public Class Methods

new(*args) click to toggle source
# File lib/ffi-geos/geojson_reader.rb, line 12
def initialize(*args)
  ptr = if args.first.is_a?(FFI::Pointer)
    args.first
  else
    FFIGeos.GEOSGeoJSONReader_create_r(Geos.current_handle_pointer, *args)
  end

  @ptr = FFI::AutoPointer.new(
    ptr,
    self.class.method(:release)
  )
end

Public Instance Methods

read(json, options = {}) click to toggle source
# File lib/ffi-geos/geojson_reader.rb, line 25
def read(json, options = {})
  cast_geometry_ptr(FFIGeos.GEOSGeoJSONReader_readGeometry_r(Geos.current_handle_pointer, ptr, json), srid: options[:srid])
rescue Geos::GEOSException => e
  raise ParseError, e
end