Skip to content

Latest commit

 

History

History
51 lines (40 loc) · 1.29 KB

line.md

File metadata and controls

51 lines (40 loc) · 1.29 KB
layout language permalink command related_commands
api-command
Ruby
api/ruby/line/
line
point polygon circle
point/
polygon/
circle/

Command syntax

{% apibody %} r.line([lon1, lat1], [lon2, lat2], ...) → line r.line(point1, point2, ...) → line {% endapibody %}

Description

Construct a geometry object of type Line. The line can be specified in one of two ways:

  • Two or more two-item arrays, specifying latitude and longitude numbers of the line's vertices;
  • Two or more Point objects specifying the line's vertices.

Longitude (−180 to 180) and latitude (−90 to 90) of vertices are plotted on a perfect sphere. See Geospatial support for more information on ReQL's coordinate system.

Example: Define a line.

r.table('geo').insert({
    :id => 101,
    :route => r.line([-122.423246,37.779388], [-121.886420,37.329898])
}).run(conn)

Example: Define a line using an array of points.

You can use the args command to pass an array of Point objects (or latitude-longitude pairs) to line.

var route = [
    [-122.423246,37.779388],
    [-121.886420,37.329898]
]
r.table('geo').insert({
    :id => 102,
    :route => r.line(r.args(route))
}).run(conn)