1

使用 hurl.it,我正在尝试对西雅图市开放数据进行 API 调用。

这是 GET 目标:

https://data.seattle.gov/resource/82su-5fxf.json?$where=within_polygon(location, 'MULTIPOLYGON(((-122.345239999941 47.7339842230969,-122.344670705637 47.7051200031236, -122.35540073991 47.7051536806063,-122.355548433321 47.7340195160745, -122.345239999941 47.7339842230969)))')

我收到的错误:

Error: function within_polygon is not defined in SoQL.

然而,inside_box 和 inside_circle 都在这个端点上工作——只是不在 within_polygon 上。数据来源于西雅图市的开放数据文档——这个特定的数据集称为 My Neighborhood:

https://data.seattle.gov/Community/My-Neighborhood-Map/82su-5fxf

这是“within_polygon”的一个工作示例,但使用了不同的端点:

https://data.seattle.gov/resource/pu5n-trf4.json? $where=within_polygon(incident_location, 'MULTIPOLYGON(((-122.345239999941 47.7339842230969,-122.344670705637 47.7051200031236, -122.35540073991 47.7051536806063,-122.355548433321 47.7340195160745, -122.345239999941 47.7339842230969)))')

在此先感谢您的帮助。

4

1 回答 1

1

within_polygon函数仅在每个数据集的最新 API 端点上可用,因此请确保您使用的是正确的端点。您应该改用这个:

https://dev.socrata.com/foundry/#/data.seattle.gov/3c4b-gdxv

使用该端点,并将位置字段名更正为location,我能够创建这个有效的查询:

https://data.seattle.gov/resource/3c4b-gdxv.json?$where=within_polygon(location,%20%27MULTIPOLYGON(((-122.345239999941%2047.7339842230969,-122.344670705637%2047.7051200031236,%20-122.35540073991%2047.7051536806063,-122.355548433321%2047.7340195160745,%20-122.345239999941%2047.7339842230969)))%27)
于 2015-10-21T00:12:50.727 回答