简体   繁体   English

哪个PostGIS SRID对空间索引最有效?

[英]Which PostGIS SRID is most efficient for a spatial index?

I have a PostGIS-enabled database with a table called locations that stores latitude-longitude points (SRID 4326) in a column called coordinates . 我有一个支持PostGIS的数据库,其中有一个名为locations的表,它将纬度 - 经度点(SRID 4326)存储在名为coordinates的列中。 However, all of my lookups on that table convert the points to a metric projection (SRID 26986) mainly to do distance comparisons. 但是,我在该表上的所有查找都将点转换为度量投影(SRID 26986),主要用于进行距离比较。

Obviously I'd like to create a spatial index on the coordinates column. 显然我想在coordinates列上创建一个空间索引。 My question is, which is the best (most computationally efficient) SRID to use in the coordinates spatial index in this case? 我的问题是,在这种情况下,哪个是coordinates空间索引中使用的最佳( 计算效率最高)SRID?

I can either index using SRID 4326... 我可以使用SRID 4326进行索引...

CREATE INDEX locations_coordinates_gist 
ON locations 
USING GIST (coordinates);

Or using SRID 26986... 或者使用SRID 26986 ......

CREATE INDEX locations_coordinates_gist 
ON locations 
USING GIST (ST_Transform(coordinates, 26986));

I discovered this helpful information reading the PostGIS documentation on the ST_Transform function... 我发现了这个有用的信息,在ST_Transform函数上阅读PostGIS文档......

If using more than one transformation, it is useful to have a functional index on the commonly used transformations to take advantage of index usage. 如果使用多个转换,则在常用转换上使用功能索引以利用索引使用是很有用的。

So it seems the answer is, use both! 所以似乎答案是,使用两者! I have created two indices, one with each SRID. 我创建了两个索引,每个SRID一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM