Android 获取所有地点的名称和坐标(类似于google地方)

发布于 2024-10-20 11:04:12 字数 81 浏览 2 评论 0原文

我正在开发一个应用程序,它在地图上显示靠近 Android 用户的所有医院、咖啡吧。知道如何获取这些详细信息。类似于谷歌地方应用程序的东西。请帮忙。

I am working on an application which displays all the hospitals,coffee bars on a map, near to the user in android. Any idea how to get these details. Something similar to google places application. Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

游魂 2024-10-27 11:04:12

实际上,我在 ViewMap 上搜索和显示信息时也遇到同样的问题。实际上我尝试过使用 Google Places API。为了使用它,您必须有一个 AdSense ID 并填写一份申请表,您可以在 http 上找到该申请表://gmaps-ws-console.appspot.com/,但如果它对你有用,那么你就是一个幸运的人,我恳求你让我知道你是如何做到的。

为了获取信息,我实际上使用了这个 URL。 http ://maps.google.com/maps/geo?q=1+Place+Delille,+Clermont+Ferrand,+France&output=xml&oe=utf8\ 在那里你可以获得 xml 信息您可以在 Android 应用程序中使用这些...

HttpClient httpclient = new DefaultHttpClient();   
String result = "";
ResponseHandler<String> handler = new BasicResponseHandler();   
byte[] utf8s;
        utf8s = txtSearch.getText().toString().getBytes("UTF-8");
        String place = new String(utf8s, "UTF-8"); 
        place = place.trim().replace(" ", "+");

        HttpGet request = new HttpGet("http://maps.google.com/maps/geo?q="+place+"&output=xml&oe=utf8");

    result = httpclient.execute(request, handler);
    String coordonees = result.substring(result.indexOf("<coordinates>"), result.indexOf("</coordinates>"));

您可以获得坐标并让您的视图地图通过以下方式显示您的位置:

mapController.setCenter(new
地理点((int) (lat * 1E6), (int) (lng
* 1E6)));

希望它对你有用...它让我找到公共场所,但不是特定的地方...

I have actually the same problem to search and display information on my ViewMap. Actually I have tried to used te Googles Places API. In oreder to use it, you must have an AdSense id and fill a form to appli that you can find at http://gmaps-ws-console.appspot.com/, but if it works for u, you're a lucky man and I beg you to let me know how you did it.

So to get information, actually I use this URL. http://maps.google.com/maps/geo?q=1+Place+Delille,+Clermont+Ferrand,+France&output=xml&oe=utf8\ and there you can get the xml information that you can use in your App Android like these...

HttpClient httpclient = new DefaultHttpClient();   
String result = "";
ResponseHandler<String> handler = new BasicResponseHandler();   
byte[] utf8s;
        utf8s = txtSearch.getText().toString().getBytes("UTF-8");
        String place = new String(utf8s, "UTF-8"); 
        place = place.trim().replace(" ", "+");

        HttpGet request = new HttpGet("http://maps.google.com/maps/geo?q="+place+"&output=xml&oe=utf8");

    result = httpclient.execute(request, handler);
    String coordonees = result.substring(result.indexOf("<coordinates>"), result.indexOf("</coordinates>"));

you can get the coordinates and the let your viewmap show your place via:

mapController.setCenter(new
GeoPoint((int) (lat * 1E6), (int) (lng
* 1E6)));

Hope it works for u... It lets me find public places, but not specific places...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文