Socrata distance_in_meters(...)即使在2.1端点上也返回错误 [英] Socrata distance_in_meters(...) returns errors even on 2.1 endpoint

查看:131
本文介绍了Socrata distance_in_meters(...)即使在2.1端点上也返回错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从 CMS护理之家比较数据并尝试使用distance_in_meters(...)订购时,出现以下错误:

When I make a query from the CMS Nursing Home Compare data and attempt to order using distance_in_meters(...) I get the following error:

Error: function distance_in_meters is not defined in SoQL.

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

The docs say distance_in_meters(...) works with the 2.1 endpoint (further information on endpoints are stuck in a redirect loop from the link at the top of that page at the time of this writing but you can get it from Google cache): https://dev.socrata.com/docs/functions/distance_in_meters.html

我已经确认数据集是使用2.1终结点的 .

I have confirmed the data set is using the 2.1 endpoint.

为确保不仅仅是order子句不是问题,我还在select中进行了设置.两种变体:

To be sure it wasn't an issue with just the order clause, I also set it up in the select. Two variations:

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

所以,问题最终出在2.1端点不支持distance_in_meters(...)还是我缺少一些愚蠢的显而易见的东西?

So, the question ultimately is does the 2.1 endpoint not support distance_in_meters(...) or am I missing something stupid obvious?

推荐答案

尽管您正在查看2.1端点的API文档,但实际上您在查询中使用的是2.0.您应该使用:

It looks like although you're looking at the API docs for the 2.1 endpoint, you're actually using the 2.0 one in your queries. You should use:

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

...而不是:

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

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

I change the root endpoint to the 2.1 version, and the query looks like it returns the results you'd expect:

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)

这篇关于Socrata distance_in_meters(...)即使在2.1端点上也返回错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆