Table of Contents

Class SpatialIndexing

Namespace
SpatialNET
Assembly
SpatialNET.Extensions.dll

Building and querying a SpatialNET.SpatialIndex`1 from geometries (ADR 0014).

public static class SpatialIndexing

Inheritance

Inherited Members

Methods

Query<T>(SpatialIndex<T>, IGeometry2D)

The items whose envelope touches or overlaps the envelope of geometry; an exact test is up to the caller.

public static IEnumerable<T> Query<T>(this SpatialIndex<T> index, IGeometry2D geometry)

Parameters

index SpatialIndex<T>

The index.

geometry IGeometry2D

The query geometry; an empty geometry yields nothing.

Returns

IEnumerable<T>

Type Parameters

T

The payload type.

Exceptions

ArgumentNullException

index or geometry is null.

ToSpatialIndex<T>(IEnumerable<T>, Func<T, Envelope2D>, int)

Builds an index over source, with envelopeOf giving each item's envelope.

public static SpatialIndex<T> ToSpatialIndex<T>(this IEnumerable<T> source, Func<T, Envelope2D> envelopeOf, int nodeCapacity = 16)

Parameters

source IEnumerable<T>

The items.

envelopeOf Func<T, Envelope2D>

The envelope of an item.

nodeCapacity int

The maximum number of children per node, at least 2.

Returns

SpatialIndex<T>

Type Parameters

T

The item type, kept as the payload.

Exceptions

ArgumentNullException

source or envelopeOf is null.

ToSpatialIndex<TGeometry>(IEnumerable<TGeometry>, int)

Builds an index over geometries, keyed by their SpatialNET.Measures.Envelope(SpatialNET.IGeometry2D).

public static SpatialIndex<TGeometry> ToSpatialIndex<TGeometry>(this IEnumerable<TGeometry> geometries, int nodeCapacity = 16) where TGeometry : IGeometry2D

Parameters

geometries IEnumerable<TGeometry>

The geometries; empty geometries are skipped.

nodeCapacity int

The maximum number of children per node, at least 2.

Returns

SpatialIndex<TGeometry>

Type Parameters

TGeometry

The geometry type, kept as the payload.

Exceptions

ArgumentNullException

geometries or one of its elements is null.

NotSupportedException

An element is none of the known geometry kinds.