Class: Charta::Point

Inherits:
Geometry show all
Defined in:
lib/charta/point.rb

Overview

Represent a Point

Instance Method Summary collapse

Methods inherited from Geometry

#!=, #==, #area, #bounding_box, #buffer, #centroid, #collection?, #convert_to, #difference, #empty?, #ewkt, factory, feature, #feature, #feature=, #find_srid, #flatten_multi, from_ewkt, from_rgeo, #initialize, #inspect, #intersection, #intersects?, #merge, #method_missing, #point_on_surface, #respond_to_missing?, #srid, srs_database, #surface?, #to_binary, #to_ewkt, #to_geojson, #to_json_feature, #to_json_object, #to_rgeo, #to_svg, #to_svg_path, #to_text, #transform, #type

Constructor Details

This class inherits a constructor from Charta::Geometry

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Charta::Geometry

Instance Method Details

#distance(point) ⇒ Object

Raises:

  • (ArgumentError)


14
15
16
17
18
# File 'lib/charta/point.rb', line 14

def distance(point)
  raise ArgumentError.new('wrong type: Charta::Point required') if point.class.name != 'Charta::Point'

  to_rgeo.distance(point.to_rgeo)
end

#xObject Also known as: longitude



4
5
6
# File 'lib/charta/point.rb', line 4

def x
  feature.x
end

#yObject Also known as: latitude



9
10
11
# File 'lib/charta/point.rb', line 9

def y
  feature.y
end