Skip to content

Latest commit

 

History

History
42 lines (33 loc) · 1.39 KB

File metadata and controls

42 lines (33 loc) · 1.39 KB
layout api-command
language Python
permalink api/python/intersects/
command intersects
related_commands
includes get_intersecting
includes/
get_intersecting/

Command syntax

{% apibody %} sequence.intersects(geometry) → sequence geometry.intersects(geometry) → bool r.intersects(sequence, geometry) → sequence r.intersects(geometry, geometry) → bool {% endapibody %}

Description

Tests whether two geometry objects intersect with one another. When applied to a sequence of geometry objects, intersects acts as a filter, returning a sequence of objects from the sequence that intersect with the argument.

Example: Is point2 within a 2000-meter circle around point1?

> point1 = r.point(-117.220406, 32.719464)
> point2 = r.point(-117.206201, 32.725186)
> r.circle(point1, 2000).intersects(point2).run(conn)

True

Example: Which of the locations in a list of parks intersect circle1?

circle1 = r.circle([-117.220406, 32.719464], 10, unit='mi')
r.table('parks')('area').intersects(circle1).run(conn)

{% infobox %} The intersects command cannot take advantage of a geospatial secondary index. If you're working with large data sets, you should consider using an index and the get_intersecting command instead of intersects. {% endinfobox %}