## GeoAcceleratedArrays.jl

AcceleratedArrays with spatial indexing
Author evetion
Popularity
3 Stars
Updated Last
1 Year Ago
Started In
August 2019

# GeoAcceleratedArrays

Accelerate Arrays using Spatial Indexes.

Combines AcceleratedArrays with LibSpatialIndex, speeding up area of interest queries, without having to do exact intersections on all geometries. Takes inspiration from the Python rtree package.

Note that as the acceleration works by using the extents of geometries, the filtered list of geometries is not guaranteed to intersect, we only guarantee that all intersecting geometries are present.

## Install

`] add GeoAcceleratedArrays`

## Usage

Apply a spatial index on a Vector with geometries using `accelerate`, after which one can quickly find the intersecting extents for a given area of interest by `findall` with the `in` predicate.

```AA = accelerate(A, RTreeIndex)
findall(in(aoi), AA)```

## Example

```using GeoAcceleratedArrays
using LibGEOS  # or any other GeoInterface compatible geometries

p1 = readgeom("POLYGON((0 0,1 0,1 1,0 0))")
p2 = readgeom("POLYGON((0 0,-1 0,-1 -1,0 0))")

acc_polys = accelerate([p1, p2], RTreeIndex)
2-element Vector{Polygon} + RTreeIndex with Extents.Extent{(:X, :Y), Tuple{Tuple{Float64, Float64}, Tuple{Float64, Float64}}}((X = (-1.0, 1.0), Y = (-1.0, 1.0))):
Polygon(Ptr{Nothing} @0x00006000030d2d00)
Polygon(Ptr{Nothing} @0x00006000030d23a0)

aoi = Extents.Extent(X=(0.5, 1), Y=(0.5, 1))
Extent(X = (0.5, 1.0), Y = (0.5, 1.0))

indices = findall(in(aoi), acc_polys)
1-element Vector{Int64}:
1```

### Used By Packages

No packages found.