解析地理位置查询始终为空

编程入门 行业动态 更新时间:2024-10-27 00:24:00
本文介绍了解析地理位置查询始终为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我目前正在尝试使Parse的地理查询系统正常工作.在我的数据浏览器上,我安装了一个带有"geopoint"类型的关键位置"的安装,其中安装了一个经度为30.27263636013176且经度为-97.75766807716373的地理点.

Im currently trying to get Parse's geo-query system to work. On my data browser, I have an installation with a key "location" of type geo-point that has a geo-point with latitude 30.27263636013176 and longitude -97.75766807716373 set in it.

但是,如果我尝试使用以下代码进行查询,则总会得到结果":[].

However, if I try to query with the following code, I always get "results":[].

curl -X GET \ -H "X-Parse-Application-Id: myAppKey" \ -H "X-Parse-REST-API-Key: myAPIKey" \ -G \ --data-urlencode 'limit=10' \ --data-urlencode 'where={ "location": { "$nearSphere": { "__type": "GeoPoint", "latitude": 30, "longitude": -97 } } }' \ api.parse/1/classes/PlaceObject

请注意查询正在成功运行;没有错误.问题是我应该安装.

Note that the query is running successfully; there are no errors. The problem is the installation I have should come up.

如果我将查询中的纬度和经度更改为与数据浏览器中显示的纬度和经度完全相同,我仍然会得到空结果.这是什么原因呢?是否无法查询某个地点附近的设备安装?

If I change the latitude and longitude in the query to exactly the latitude and longitude shown in the data browser, I still get empty results. What is the reason for this? Is it not possible to query for device installations near a point?

推荐答案

出于充分的原因,无法从客户端查询Installation类. Installation类中存储的敏感信息太多,无法从客户端进行查询.

The Installation class can't be queried from the client, for good reason. Too much sensitive information is stored in the Installation class to allow querying from a client.

将location属性移到您可以查询的另一个类中,或者在Cloud Function中查询它.

Either move the location property to another class you can query, or query it in a Cloud Function.

如果使用Parse.Cloud.useMasterKey();,则可以在Cloud Code中查询它,尽管我强烈建议使用其他类来存储location.

You can query it in Cloud Code if you use Parse.Cloud.useMasterKey();, though I strongly recommend using a different class to store the location.

更多推荐

解析地理位置查询始终为空

本文发布于:2023-05-29 21:33:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/353311.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:地理位置   为空

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!