简体   繁体   English

将 Postgis SRID 与 Redis 的球形 model 匹配?

[英]Match Postgis SRID with Redis' spherical model?

I'm using Postgres (with PostGIS) and I have geometry columns which have the SRID of 4326. In my stack, Redis is acting as a cache and holds the location data using it's geo functionality , specifically, let's say I have a location in Postgres like so:我正在使用 Postgres(带有 PostGIS),并且我有 SRID 为 4326 的几何列。在我的堆栈中,Redis 充当缓存并使用它的地理功能保存位置数据,具体来说,假设我在Postgres 像这样:

INSERT INTO locations(geom) VALUES(ST_GeomFromText('POINT(40.7547 -73.9614)', 4326)) RETURNING 'id';

Then the object gets added to Redis:然后将 object 添加到 Redis 中:

redis> GEOADD someId -73.9614 40.7547

The question is, because Redis uses a totally spherical model of the globe, is it beneficial to use a similarly spherical model SRID for postgres?问题是,因为 Redis 使用了一个完全球形的 model,所以对 postgres 使用类似球形的 model SRID 是否有益? I found EPSG:4047 which is a sphere.我发现EPSG:4047是一个球体。

Are there time, accuracy, or other benefits or pitfalls I'm not seeing?是否有我没有看到的时间、准确性或其他好处或缺陷?

Keep the data in EPSG:4326, if all computations are to be done in the Redis environment it won't matter;将数据保存在 EPSG:4326 中,如果所有计算都在 Redis 环境中完成,则无所谓; you cannot pass in spatial reference information, and Redis seems to assume the WGS84 based (Spherical) Web Mercator projection ('seems' because they state to use a wrongly assigned and deprecated EPSG code for it...), at least for their indexing implementation. you cannot pass in spatial reference information, and Redis seems to assume the WGS84 based (Spherical) Web Mercator projection ('seems' because they state to use a wrongly assigned and deprecated EPSG code for it...), at least for their indexing执行。

The distance calculation via Haversines is unaffected by changing between those reference systems (and the CRS that Redis uses);通过 Haversines 的距离计算不受这些参考系统(以及 Redis 使用的 CRS)之间变化的影响; the formulae work independent from any spatial reference other than the spherical radius.这些公式独立于除球面半径之外的任何空间参考。

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

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