GeocodeQuery

编程入门 行业动态 更新时间:2024-10-24 07:35:51
本文介绍了GeocodeQuery - GeoCoordinate 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

有人能解释一下这些代码之间的区别吗?GeoCoordinate 属性在 GeocodeQuery 中的作用是什么?

Can somebody explain me difference between these pieces of code? What is the role of GeoCoordinate property in GeocodeQuery?

#1 - 这仅适用于互联网连接

GeocodeQuery geocodeQuery = new GeocodeQuery();
geocodeQuery.GeoCoordinate = new GeoCoordinate();
geocodeQuery.SearchTerm = "London";

IList<MapLocation> locations = await geocodeQuery.GetMapLocationsAsync();

#2 - 这在没有互联网连接的情况下工作

// my location
Geolocator geolocator = new Geolocator();
geolocator.DesiredAccuracy = PositionAccuracy.High;

Geoposition position = await geolocator.GetGeopositionAsync();

// geocode query
GeocodeQuery geocodeQuery = new GeocodeQuery();

geocodeQuery.GeoCoordinate = position.Coordinate.ToGeoCoordinate();
geocodeQuery.SearchTerm = "London";

IList<MapLocation> locations = await geocodeQuery.GetMapLocationsAsync();

推荐答案

GeoCoordinate 属性是使查询居中的位置.

The GeoCoordinate property is the location upon which to center the query.

GeocodeQuery 将查找指定位置附近的位置.

The GeocodeQuery will find locations near the specified location.

我会假设,如果您不指定位置,它会发出网络请求来尝试识别您的位置.(可能通过反向 IP 查找或尝试根据公共 WiFi 热点数据获取您的当前位置.)
如果没有指定位置,这是基于查询回退到使用当前位置.

I would assume that if you don't specify a location it makes a network request to try and identify your location. (Possibly by a reverse IP lookup or to attempt to obtain your current location based on public WiFi hotspot data.)
This is based on the query falling back to use current location if no location is specified.

另请注意,如果用户尚未下载本地(到查询中心/地理坐标)地图数据,那么我希望在这种情况下也需要网络请求.
另请注意,某些地图数据将被缓存,因此可能会影响您对此的测试.

Also note that if the user has not downloaded local (to the query center / geocoordinate) maps data then I would expect a network request to be necessary in that scenario too.
Note also that some maps data will be cached so that may impact your testing of this also.

这篇关于GeocodeQuery - GeoCoordinate 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

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

发布评论

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

>www.elefans.com

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