You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- the first with `id` 1, associated with the box specified by `[xmin=0.0,ymin=0.0]` and `[xmax=1.0,ymax=1.0]`.
25
29
- the second with `id` 2, associated with the box specified by `[xmin=0.0,ymin=0.0]` and `[xmax=2.0,ymax=2.0]`.
26
30
27
31
## Queries
28
-
Thereafter, you can perform queries on the `rtree` using either (i) `intersects(rtree, minvalues, maxvalues)` for all items intersecting the box specified by `minvalues` and `maxvalues`, or (ii) `knn(rtree, minvalues, maxvalues, k)` for the `k` nearest items in `rtree` to the box specified by `minvalues` and `maxvalues`.
32
+
33
+
Thereafter, you can perform queries on the `rtree` using either (i) `intersects(rtree, minvalues, maxvalues)`
34
+
for all items intersecting the box specified by `minvalues` and `maxvalues`, or (ii)
35
+
`knn(rtree, minvalues, maxvalues, k)` for the `k` nearest items in `rtree` to the box
will return the vector `[1,2]` on the `rtree` constructed earlier, to indicate that items with ids `1` and `2` intersects the box specified by `[xmin=0.0,ymin=0.0]` and `[xmax=1.0,ymax=1.0]`.
36
46
37
-
You can also perform queries on an individual point, so
47
+
will return the vector `[1, 2]` on the `rtree` constructed earlier, to indicate that items
48
+
with ids `1` and `2` intersects the box specified by `[xmin=0.0, ymin=0.0]` and `[xmax=1.0, ymax=1.0]`.
49
+
50
+
Any GeoInterface.jl or Extents.jl compatible object can be used directly instead
51
+
of defining the `Extent` manually - the extent will either be detected or calculated.
52
+
53
+
54
+
You can also perform queries on any individual GeoInterface.jl compatible point, so:
55
+
38
56
```julia
39
-
LibSpatialIndex.intersects(rtree, [1.,1.])
57
+
LibSpatialIndex.intersects(rtree, (1.0, 1.0))
40
58
```
41
-
will return the ids `[1,2]` in the `rtree` constructed earlier, and
59
+
60
+
will return the ids `[1, 2]` in the `rtree` constructed earlier, and:
61
+
42
62
```julia
43
-
LibSpatialIndex.intersects(rtree, [2.,2.])
63
+
LibSpatialIndex.intersects(rtree, [2.0, 2.0])
44
64
```
45
-
will only return the vector `[2]`, because item 1 does not contain the point `[2,2]`.
65
+
66
+
will only return the vector `[2]`, because item 1 does not contain the point `[2.0, 2.0]`.
46
67
47
68
### k Nearest Neighbors
48
-
For `knn` queries,
69
+
70
+
For `knn` queries:
71
+
49
72
```julia
50
-
LibSpatialIndex.knn(rtree, [2.,2.], 1)
73
+
LibSpatialIndex.knn(rtree, [2.0, 2.0], 1)
51
74
```
75
+
52
76
returns the vector `[2]` because the item with id `2` is closest to the point `[2.0, 2.0]`, and
77
+
53
78
```julia
54
-
sort(LibSpatialIndex.knn(rtree, [2.,2.], 2))
79
+
sort(LibSpatialIndex.knn(rtree, [2.0, 2.0], 2))
55
80
```
56
-
returns the vector `[1,2]`. If the value of `k` exceeds the number of items in the `rtree`, then fewer than `k` items will be returned, so
81
+
82
+
returns the vector `[1, 2]`. If the value of `k` exceeds the number of items in the `rtree`,
0 commit comments