Spatial indexes are data structures the support searches and computation that depend on geometric relationships between the stored data (k-nearest-neighbors, identify elements in a defined region, etc). Use this tag for questions about selecting, writing, or using spatial indexes in your code, including the use of spatial indexes in database management systems.
Questions tagged [spatial-index]
281 questions
73
votes
5 answers
What is a SPATIAL INDEX and when should I use it?
Like most of the average PHP web developers I use MySql as a RDBMS. MySql (as other RDBMS also) offers SPATIAL INDEX features, but I'm don't get it very well. I have googled for it but didn't find clear real world examples to clarify my bad…

demian
- 739
- 1
- 5
- 3
43
votes
4 answers
Optimising the drawing of overlapping rectangles
I have a large number of rectangles, and some overlap others; each rectangle has an absolute z-order and a colour. (Each 'rectangle' is actually the axis-aligned bounding box of a particle effect, mesh or texture and may be semi-transparent. But…

Will
- 73,905
- 40
- 169
- 246
21
votes
3 answers
Is there any documented free R-Tree implementation for .NET?
I found some open source R-Tree implementations in C#, but none with documentation nor signs of being used by someone else than the developer.

Jader Dias
- 88,211
- 155
- 421
- 625
19
votes
7 answers
Approximate, incremental nearest-neighbour algorithm for moving bodies
Bounty
This question raises several issues. The bounty will go to an answer which addresses them holistically.
Here's a problem I've been playing with.
NOTE I'm especially interested in solutions that are not based in Euclidian space.
There is a…

spraff
- 32,570
- 22
- 121
- 229
18
votes
2 answers
Spatial Index in MySQL - ERROR - Cannot get geometry object from data you send to the GEOMETRY field
I am new to the whole 'spatial index' thing, but it seems to be the best solution for filtering based on latitude/longitude. So I added a column to my table:
So I created a geometry field:
ALTER TABLE `addresses` ADD `point` POINT NOT NULL
And…

jisaacstone
- 4,234
- 2
- 25
- 39
16
votes
2 answers
Where do I store shapes in an octree?
A little background on design decisions thus far... I have developed an octree structure that can store points. I have chosen to limit the recursion of "generations" based on a certain base voxel size. Child nodes are only created when points are…

Phlucious
- 3,704
- 28
- 61
15
votes
2 answers
libspatialindex and Rtree on python
Okay, so I am trying to install libspatialspatialindex to my Ubuntu machine python. I did follow all the instructions and downloaded libspatialindex1_1.4.0-1.1_amd64.deb from http://packages.ubuntu.com/lucid/libspatialindex1 and downloaded the amd64…

Neelabh Pant
- 807
- 2
- 7
- 12
15
votes
8 answers
Algorithm to quickly find animals away from the herd
I am developing a simulation program. There are herds of animals (wildebeests), and in that herd, I need to be able to find one animal that is away from the herd.
On the picture below, green dots are away from the herd. It is these points that I'd…

user1493046
- 352
- 1
- 3
- 17
14
votes
3 answers
Implementations of spatial indexes in Haskell?
Are there any good implementations of spatial indexes in Haskell such as R-tree, kd-tree, etc...

mentics
- 6,852
- 5
- 39
- 93
12
votes
8 answers
Why are my spatial searches slower in SQL Server than PostGIS?
I'm working on moving some spatial searching capabilities from Postgres with PostGIS to SQL Server and I'm seeing some pretty terrible performance, even with indexes.
My data is around a million points, and I want to find out which of those points…

Brendan Long
- 53,280
- 21
- 146
- 188
12
votes
3 answers
Selecting a good SQL Server 2008 spatial index with large polygons
I'm having some fun trying to pick a decent SQL Server 2008 spatial index setup for a data set I am dealing with.
The dataset is polygons, representing contours over the whole globe. There are 106,000 rows in the table, the polygons are stored in a…

andynormancx
- 13,421
- 6
- 36
- 52
11
votes
2 answers
Spatial matching of big datasets
I have a dataset with about 100000 points and another dataset with roughly 3000 polygons. For each of the points I need to find the nearest polygon (spatial match). Points inside a polygon should match to that polygon.
Computing all-pairs distances…

krlmlr
- 25,056
- 14
- 120
- 217
10
votes
0 answers
What is the R*-Tree algorithm?
Where can I find enough documentation to implement an R*-Tree? Specifically, I need to be able to:
Insert nodes
Remove nodes
Search for K nearest neighbours
Find all nearest neighbours within distance x.
Is there a single place where this…

fmark
- 57,259
- 27
- 100
- 107
10
votes
3 answers
Query processor could not produce a query plan because of the hints defined in this query. Resubmit the query and without using SET FORCEPLAN
I am running following:
DECLARE @g geography;
declare @point nvarchar(50) =''
declare @i int =0,
@lat decimal(8,6) =0.0,
@long decimal(8,6) =0.0,
@start datetime = getdate()
set @lat =(select (0.9 -Rand()*1.8)*100)
set @long…

Matas Vaitkevicius
- 58,075
- 31
- 238
- 265
10
votes
1 answer
Hibernate spatial index annotation
I am using jts geometry object to store my geometry objects as an Oracle SDO_Geometry. However when I want to use SDO_GEOM.RELATE methods they are not working properly,I realized that I need to create a spatial index but dont know how to do with…

Merve Kaya
- 111
- 7