如何使用地址更新 MapView?
我想更新 iPhone 应用程序中的 MapView。使用地理坐标,这很简单。但如果我不知道坐标怎么办?我想使用地址字符串来更新它,就像您在谷歌地图的文本框中输入的那样。
为了提供更多背景信息,在我的应用程序中,MapView 显示了用户的当前位置。检索到位置后,我使用 ReverseGeocoder 将其转换为人类可读的地址,该地址显示在地图下方的 TextView 中。
但位置经常是错误的 - 这个应用程序主要在纽约市使用,而 iPhone GPS 在这里经常不准确(因为高楼大厦?)。在这种情况下,用户可以点击文本视图并输入实际地址。此时,我希望 MapView 使用他们输入的地址进行更新。但对我来说如何实现这一点并不明显。
I want to update a MapView in an iPhone app. Using a geocordinate, this is trivial. But what if I don't know the coordinate? I want to update it using an address string, like you would enter in the text box of google maps.
To give a little more background, in my app a MapView is displayed with the user's current location. After the location is retrieved, I use the ReverseGeocoder to translate it into a human readable address, that is displayed in a TextView below the map.
But the location is often wrong - this app will mainly be used in New York City and the iPhone GPS is often inaccurate here (due to tall buildings?). In this case, the user can tap the text view and put in the actual address. At this point, I want the MapView to update with the address they entered. But it's not obvious to me how to make that happen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
iPhone SDK 不提供该功能。您需要使用地理编码服务,例如 Google Geocoding API 。
Google API 提供 HTTP 服务来查找地理位置。例如,要确定Google总部的位置,您可以查询
您也可以更改结果格式。
The iPhone SDK doesn't provide that functionality. You will need to use a geocoding service like Google Geocoding API.
Google API provides an HTTP service to look up geolocation. For example, to determine the location for Google headquarter, you can query
You can also change the results format.