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
3
votes
2 answers
Query on spatial index not responding
I have a database sitting on a SQL Server 2008 with ~12 billion rows that all contain lat, lon and a corresponding geography fields. I recently needed to add the ability to query on the geography field. I added spatial index, which took 6 days to…

tidwall
- 6,881
- 2
- 36
- 47
3
votes
1 answer
Spatial index hints don't work in SQL Server 2008?
Using the following
SELECT *
FROM dbo.GRSM_WETLAND_POLY
CROSS APPLY (SELECT TOP 1 Name, shape
FROM GRSM.dbo.GRSM_Trails --WITH(index(S319_idx))
WHERE GRSM_Trails.Shape.STDistance(dbo.GRSM_WETLAND_POLY.Shape)…

tpcolson
- 716
- 1
- 11
- 27
2
votes
1 answer
Which proximity function provides fastest and make use of spatial index in postGIS?
I am new to PostgreSQL / PostGIS. I am evaluating it to solve a simple algorithm : Try to find all points in a radius (meters). Here is my table :
=> \d+ theuser;
Table "public.theuser"
Column | Type |…

smallufo
- 11,516
- 20
- 73
- 111
2
votes
1 answer
How to plot hyperrectangles of scipy.spatial.kdtree
Im trying to perform a KD-tree on a set of x,y coordinate pairs for spatial indexing them. I found scipy.spatial.kdtree to perform this quickly. However I can't seem to manage plotting hyperrectangles of the kdtree (Im using matplotlib).
Does anyone…

Qiicken
- 43
- 3
2
votes
0 answers
How to create GIST spatial index on postgis with JPA annotations
I am using springboot, hibernate-spatial with postgis database to store and query spatial objects. I wonder if there is a way to create GIST spatial index on postgis with JPA annotations. I have only seen very old posts about spatial index creation…

Mikail Yetkin
- 31
- 4
2
votes
3 answers
Gist index on Postgres/PostGIS still slow
I am not an expert at Postgres/GIS subjects and I have an issue with a large database (over 20 million records) of geometries. First of all my set up looks like this:
mmt=# select version();
-[ RECORD 1…

planetguru
- 425
- 3
- 14
2
votes
1 answer
Using boost::geometry::index::indexable within an IndexableGetter in Windows
Building on top of this example:
https://www.boost.org/doc/libs/1_75_0/libs/geometry/doc/html/geometry/spatial_indexes/rtree_examples/using_indexablegetter_function_object___storing_indexes_of_external_container_s_elements.html
I have constructed…

user28307
- 21
- 3
2
votes
2 answers
What are good ways to upload large amount of spatial data in Postgis?
I have a large amount of spatial data I need analyze and put into use in an application. Original data is represented in WKT format and I'm wrapping it into a INSERT SQL statements to upload the data.
INSERT INTO sp_table ( ID_Info, "shape") VALUES…

ablimit
- 2,301
- 6
- 27
- 41
2
votes
1 answer
k nearest neighbors query in 3-space
I have a data set stored in database table that includes a position in 3-space. I need to retrieve the k nearest neighbors in an efficient manner. My datastore does not include native spacial indexes for 3 dimensions. How do I simulate a spacial…

John F. Miller
- 26,961
- 10
- 71
- 121
2
votes
0 answers
How to implement spatial indexing for triangles
I would like to implement spatial index for triangles (unstructured mesh) for point search to use in linear TIN interpolation. Is there any python library or code available to understand this. I tried scipy.spatial.delaunay, but I don't want to…

psaibharadwaj
- 61
- 6
2
votes
1 answer
"Warnings: Columns With No Statistics" over spatial index
I've got a SQL Server 2008 R2 machine with a table with 2 columns:
One for ID (primary key clustered)
One for geography data
I've created a spatial index on the second one, but when I want to query the "nearest neighbour" I got a "Columns With No…

Jesús Muela
- 21
- 2
2
votes
1 answer
Spatial Index/R Tree Support in Perl
Anyone got any good hints for working with an RTree in Perl? Either a pure RTree implementation which is performant or something I could hijack from a GIS project? Or would it be easier to use something like SQLite's spatial index support?
Cheers

andeyatz
- 428
- 3
- 9
2
votes
1 answer
Geodjango/postgres ForeignKey relationship like a spatial index
I actually looking for the best and easiest way to make a spatial index with 4 tables where the structure of data already in place.
As picture show it, layer are overlayed and fit perfectly. Spatial operation could do the job in the query, but for a…

Alex C.
- 87
- 10
2
votes
1 answer
Data Structure For Determining Intersection of Rectangle with a Larger Set of Rectangles
My data set is made of many rectangles that lie on an x,y plane (represented by a set of quad points). 99.9% of the time these rectangles will not overlap, but very rarely they will. I'm trying to find an optimal data structure for storing the…

user2481095
- 2,024
- 7
- 22
- 32
2
votes
0 answers
Cannot set spatial index to geometry type - #1464
I use MySQL version 5.5.49. They type of the column is geometry and the engine of the table is InnoDB.
I try something like
ALTER TABLE geom ADD SPATIAL INDEX(field);
or
ALTER TABLE geom ADD SPATIAL INDEX table (field);
or
CREATE SPATIAL INDEX…

slevin
- 4,166
- 20
- 69
- 129