我目前正在尝试使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.
更多推荐
解析地理位置查询始终为空
发布评论