Android的问题得到纬度和放大器;从一个给定的地址经度 [英] android problem to get latitude & longitude from a given address

查看:126
本文介绍了Android的问题得到纬度和放大器;从一个给定的地址经度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到纬度和放大器;从长期用户给出的地址,我使用以下code,

I am trying find lat & long from user given address, for that i am using following code,

GeoPoint pointForEnterAddr;


try {

    List<Address> address = coder.getFromLocationName(enterAddr, 1);

                    if (address == null)

                     pointForEnterAddr = null;

                    else {
                        Address location = address.get(0);
                        System.out.println("Lat in button click :"
                                + location.getLatitude());
                        System.out.println("Long in button click :"
                                + location.getLongitude());


pointForEnterAddr = new GeoPoint((int) (location.getLatitude() * 1E6),
                    (int) (location.getLongitude() * 1E6));


}
 catch (Exception ex) {
                    System.out.println("Error here :" + ex);
                }

但每次它的到来赶上部分和放大器;显示异常,
java.io.IOException异常:服务不可用

But everytime it coming to catch part & shows exception, java.io.IOException: Service not Available

我怎样才能解决这个问题,并得到适当的输出? PLZ告诉我。

How can i solve it and get proper output? Plz tell me.

感谢您

推荐答案

仅举一种替代方法,您可以使用谷歌地图基于REST的反向地理codeR 。你也许可以用这个作为后备。正如你会在你的应用程序使用谷歌地图也一样,你要善于与API规则。

Just to mention an alternative, you can use the Google Maps' REST based reverse geocoder. You can probably use this as a fallback. As you would be using Google Maps in your app too, you should be good with the API rules.

这篇关于Android的问题得到纬度和放大器;从一个给定的地址经度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆