I want to create a large database of GPS coordinates that can be queried by saying "Return all coordinates that are within 'n' metres of [this coordinate]".
I would like to know how to implement Quadtree Indexing in Sqlserver2008?
I want to write a .net module that calls the query which uses quad tree so that i can retrieve the objects so quickly.
How can i implement the above functionality?
Thanks in advance
A spatial index is a type of extended index that allows you to index a spatial column. A spatial column is a table column that contains data of a spatial data type, such as geometry or geography.
With the spatio-temporal library, you can use functions to index points within a region, on a region containing points, and points within a radius to enable fast queries on this data during location analysis.
Creates a spatial index on a specified table and column in SQL Server. An index can be created before there is data in the table. Indexes can be created on tables or views in another database by specifying a qualified database name. Spatial indexes require the table to have a clustered primary key.
CREATE TABLE mytable (id INT NOT NULL, mypoint GEOGRAPHY NOT NULL, ...)
CREATE SPATIAL INDEX SX_mytable_mypoint ON mytable (mypoint)
SELECT *
FROM mytable
WHERE mypoint.STDistance(geography::STGeomFromText(N'POINT (latitude longitude)', 4326) <= @N
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With