我正在尝试按照 Eve 文档 (v0.6.1-dev) 进行 GeoJSON 查询:http://python-eve.org/features.html

但是,postman 中的查询返回错误:

Postman GET: http://localhost:5000/people?where= {"location": {"$near": {"$geometry": {"type":"Point", "coordinates": [10.0, 20.0]}, "$maxDistance": 1000} }}

错误:
500内部服务器错误
服务器遇到内部错误,无法完成您的请求。服务器过载或应用程序中存在错误。

'people' 集合包含如下所示的位置:

postman GET: http://localhost:5000/people

"_items": [
    {
        "_updated": "Wed, 30 Sep 2015 10:26:51 GMT",
        "firstname": "John",
        "lastname": "Doe",
        "born": "Thu, 27 Aug 1970 14:37:13 GMT",
        "role": [
            "author"
        ],
        **"location": {
            "type": "Point",
            "coordinates": [
                100,
                0
            ]
        },**
        "_links": {
            "self": {
                "href": "people/560bb8eb6adf7d0e70f26cd0",
                "title": "person"
            }
        },

知道为什么这不起作用吗?

最佳答案

尝试打开 Debug模式(在设置中设置 DEBUG = True)并查看实际错误是什么。该字段很可能没有地理索引(Eve 不会自动为您创建索引)。

更新:从 v0.6 开始,您还可以让 Eve 为您维护索引,请参阅文档中的 mongo_indexes 关键字

关于eve - GeoJSON Python Eve 示例,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32864091/

10-13 08:52