Class: OGR::Point

Inherits:
Geometry show all
Defined in:
lib/ffi-ogr/point.rb

Instance Attribute Summary

Attributes inherited from Geometry

#ptr

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Geometry

#add_geometry, #add_geometry_directly, #add_point, create_empty, #flatten, #free, from_geojson, #get_area, #get_boundary, #get_envelope, #get_geometry_type, #get_length, #get_spatial_ref, #initialize, #is_3d?, release, #set_point, #to_geojson, #to_gml, #to_kml, #transform

Constructor Details

This class inherits a constructor from OGR::Geometry

Class Method Details

.create(coords) ⇒ Object



3
4
5
6
7
# File 'lib/ffi-ogr/point.rb', line 3

def self.create(coords)
  point = OGR::Tools.cast_geometry(FFIOGR.OGR_G_CreateGeometry(:point))
  point.add_point(coords)
  point
end

Instance Method Details

#get_xObject Also known as: x



9
10
11
# File 'lib/ffi-ogr/point.rb', line 9

def get_x
  FFIOGR.OGR_G_GetX(@ptr, 0)
end

#get_yObject Also known as: y



14
15
16
# File 'lib/ffi-ogr/point.rb', line 14

def get_y
  FFIOGR.OGR_G_GetY(@ptr, 0)
end

#get_zObject Also known as: z



19
20
21
# File 'lib/ffi-ogr/point.rb', line 19

def get_z
  FFIOGR.OGR_G_GetZ(@ptr, 0)
end