ST_DWithin文档说,第三个参数(距离)以米为单位。但是当我执行一些查询时,它似乎将第三个参数作为“度数”?
这是我的简化表结构:
> \d+ theuser;
Table "public.theuser"
Column | Type | Modifiers | Storage | Description
----------+------------------------+-----------+----------+-------------
id | bigint | not null | plain |
point | geometry | | main |
Indexes:
"theuser_pkey" PRIMARY KEY, btree (id)
"point_index" gist (point)
Referenced by:
...
Has OIDs: no
所有点都以 SRID=4326 存储。
这是查询:
> select * from theuser where ST_DWithin(point , ST_GeomFromText('POINT(120.9982 24.788)',4326) , 100 );
它将第三个参数 (100) 作为 'degree' ,因此它返回所有数据,我必须缩小到 0.001 才能找到附近的点。
但是我如何直接将米作为第三个参数传递(我不想做米/度转换)?我的查询有什么问题?为什么 postgreSQL 不像文档所说的那样把它当作米?
环境:
> select version();
version
-----------------------------------------------------------------------------------------------------------
PostgreSQL 8.4.9 on i486-pc-linux-gnu, compiled by GCC gcc-4.4.real (Ubuntu 4.4.3-4ubuntu5) 4.4.3, 32-bit
> SELECT postgis_lib_version();
postgis_lib_version
---------------------
1.4.0
如果是SRID导致了这个问题,那么什么SRID直接以“米”为单位呢?(我尝试转换为 SRID=2163 ,但仍在度数)谢谢。