Class GeoRuby::SimpleFeatures::Point
In: lib/geo_ruby/simple_features/point.rb
Parent: Geometry

Represents a point. It is in 3D if the Z coordinate is not nil.

Methods

External Aliases

x -> lon
  if you prefer calling the coordinates lat and lon (or lng, for GeoKit compatibility)
x -> lng
y -> lat
from_x_y -> from_lon_lat
from_x_y_z -> from_lon_lat_z
from_x_y_m -> from_lon_lat_m
from_x_y_z_m -> from_lon_lat_z_m

Attributes

m  [RW] 
x  [RW] 
y  [RW] 
z  [RW] 

Public Class methods

creates a point from the X and Y coordinates

creates a point from the X, Y and M coordinates

creates a point from the X, Y and Z coordinates

creates a point from the X, Y, Z and M coordinates

Public Instance methods

tests the equality of the position of points + m

Bounding box in 2D/3D. Returns an array of 2 points

Ellipsoidal distance in m using Vincenty‘s formula. Lifted entirely from Chris Veness‘s code at www.movable-type.co.uk/scripts/LatLongVincenty.html and adapted for Ruby. Assumes the x and y are the lon and lat in degrees. a is the semi-major axis (equatorial radius) of the ellipsoid b is the semi-minor axis (polar radius) of the ellipsoid Their values by default are set to the ones of the WGS84 ellipsoid

Return the distance between the 2D points (ie taking care only of the x and y coordinates), assuming the points are in projected coordinates. Euclidian distance in whatever unit the x and y ordinates are.

set_lon_lat(x,y)

Alias for set_x_y

set_lon_lat_z(x,y,z)

Alias for set_x_y_z

sets all coordinates of a 2D point in one call

sets all coordinates in one call. Use the m accessor to set the m.

Returns the sperical distance in m, with a radius of 6471000m, with the haversine law. Assumes x is the lon and y the lat, in degrees (Changed in version 1.1). The user has to make sure using this distance makes sense (ie she should be in latlon coordinates)

[Validate]