Socrata distance_in_meters(...) returns 即使在 2.1 端点上也有错误

Socrata distance_in_meters(...) returns errors even on 2.1 endpoint

当我从 CMS Nursing Home Compare data 进行查询并尝试使用 distance_in_meters(...) 进行订购时,出现以下错误:

Error: function distance_in_meters is not defined in SoQL.

文档说 distance_in_meters(...) 适用于 2.1 端点(在撰写本文时,有关端点的更多信息停留在该页面顶部 link 的重定向循环中,但您可以从 Google 缓存中获取):https://dev.socrata.com/docs/functions/distance_in_meters.html

我已经确认数据集是using the 2.1 endpoint

为了确保这不是 order 子句的问题,我还在 select 中进行了设置。两种变化:

  1. https://data.medicare.gov/resource/4pq5-n9py.json?$select=*,%20distance_in_meters(位置,%20%27POINT%20(-78.9627624%2043.0171854)%27)%20AS%20range&$where =within_circle(位置,43.0171854,-78.9627624,16093.44)
  2. https://data.medicare.gov/resource/4pq5-n9py.json?$where=within_circle(位置,43.0171854,-78.9627624,16093.44)&$order=distance_in_meters(位置,%20%27POINT%20(-78.9627624 %2043.0171854)%27)

所以,问题最终是 2.1 端点不支持 distance_in_meters(...) 还是我遗漏了一些明显的愚蠢的东西?

看起来虽然您正在查看 2.1 端点的 API 文档,但实际上您在查询中使用的是 2.0 端点。你应该使用:

https://data.medicare.gov/resource/b27b-2uc7.json

... 而不是:

https://data.medicare.gov/resource/4pq5-n9py.json

我将根端点更改为 2.1 版本,查询看起来像 returns 您期望的结果:

https://data.medicare.gov/resource/b27b-2uc7.json?$where=within_circle(location,43.0171854,-78.9627624,16093.44)&$order=distance_in_meters(location,%20%27POINT%20(-78.9627624%2043.0171854)%27)