草庐IT

getFromLocationName

全部标签

java - 根据城市、 zip 或街道名称获取经纬度

在我当前的android应用程序中,我想根据输入的城市名称、街道名称或邮政编码获取坐标。我怎样才能做到这一点?最好的问候,罗尼 最佳答案 查看方法Geocoder.getFromLocationName(cityName,maxResults).像这样使用它:ListaddressList=geoCoder.getFromLocationName(cityName,1);Addressaddress=addressList.get(0);if(address.hasLatitude()&&address.hasLongitude()

Android Geocoder.getFromLocationName 停止使用边界

我使用Geocoder.getFromLocationName来验证用户插入的地址。我检查返回的ArrayList,如果它是唯一的结果,那么一切都很好。我也使用边界,所以我只能在特定区域内获得结果(Geocoder)。在上周的某个时候突然停止工作之前,这在很长一段时间内都运行良好。返回的结果现在总是相同的,并且总是与我作为地址名称传递的字符串无关...当我删除边界时,它工作正常。有没有人遇到过类似的问题?Google在功能的实现方面有什么改变吗? 最佳答案 我们最近也开始遇到这种情况。我发现了两天前有人在AOSP问题跟踪器上提交的错

Android getFromLocationName 返回边界框外的结果

我正在通过我的Android应用进行位置搜索。用户输入地址,我使用以下代码进行查找,privatevoiddoSearch(Stringquery){FNMApplication.logInfo("Searching:"+query);//createageocoderGeocodergc=newGeocoder(this,Locale.getDefault());try{//lookuplocationswhichmatchthequeryinputbytheuserListaddresses=gc.getFromLocationName(query,5,-44.00,111.00,

android - Geocoder getFromLocationName 未找到地址

如果我正在搜索营业地点,GeocodergetFromLocationName不会返回任何内容。到目前为止,这是我的发现:杂货店、商业建筑->无结果schools->查找结果,但只返回纬度和经度。我必须进行反向地理编码才能根据坐标获取地址,但地址不准确。完整地址->同学校,只返回纬度和经度医院和药房->返回经纬度我已经在装有Googlemap的1.6、2.1和2.2设备上对此进行了测试。我正在尝试查找是否在SDK的某处解释了限制,但没有,除了:Theamountofdetailinareversegeocodedlocationdescriptionmayvary,forexample

android - java.io.IOException : Unable to parse response from server at getFromLocationName() 异常

我知道这个问题以前经常被问到,但我无法从任何答案或搜索结果中得到解决方案。我必须尽快解决这个问题..我正在尝试从用户输入的地址获取纬度和经度,但我继续获取:java.io.IOException:Unabletoparseresponsefromserver我正在使用这段代码:Geocodergeocoder=newGeocoder(this,Locale.getDefault());StringnewAddress=(String)saveas.getText().toString();Listaddresses=geocoder.getFromLocationName(newAdd

android - geocoder.getFromLocationName 仅返回 null

在过去的两天里,我因IllegalArgumentException而失去理智当我试图从地址中获取坐标时,我在Android代码中收到错误,或者甚至相反,从经度和纬度中获取地址。这是代码,但我看不到错误。它是一个标准的代码fragment,很容易在Google搜索中找到。publicGeoPointdetermineLatLngFromAddress(ContextappContext,StringstrAddress){Geocodergeocoder=newGeocoder(appContext,Locale.getDefault());GeoPointg=null;try{Sys

android - getFromLocationName 错误,服务不可用。一直在工作,停止

在我的应用程序中,我使用的是getFromLocationName,直到最近它一直在应用程序中运行,现在我突然收到“服务不可用”。异常显示:Geocoder.getFromLocationName(Geocoder.java:178)这是我使用的代码:Geocodercoder=newGeocoder(this);Listaddress=null;try{address=coder.getFromLocationName(navAddr,5);}catch(IOExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();}

java - Android Geocoder getFromLocationName 总是返回 null

我一直在尝试对字符串进行地理编码以获取其坐标,但我的程序总是崩溃,因为每当我尝试使用getFromLocationName()时,它都会返回null。几个小时以来,我一直在尝试解决此问题,但没有任何效果。这是我的代码publicclassMainActivityextendsActivity{privateGoogleMapmMap;Listaddresses;MarkerOptionsmiami;StringmyLocation="Miami,Florida";protectedvoidonCreate(BundlesavedInstanceState){super.onCreate

android - Geocoder.getFromLocationName() 在 ICS 设备中不工作

我有两个设备。一个是HTCWildFireS,另一个是HTC1V。我在我的应用程序中使用了Geocoder.getFromLocationName()。它在HTCwildfireS上运行成功。但是在HTC1V中我得到了以下错误。它为什么来了?我该如何解决这个问题?请任何人帮助我。代码GeocodergeoCoder=newGeocoder(getBaseContext(),Locale.getDefault());//sistheaddressListaddresses=geoCoder.getFromLocationName(s,5);//HereigotthefollowingEx