百度地图地址转换经纬度
下载地址http://download.csdn.net/detail/kai909/8696313
不好意思发现上传jar包传不上去,以为我是建的一个项目,想传,看了下只能传代码,想要的话发邮件,我看到的话会回复。
1.定位经纬度地址转换经纬度都经过了封装,所以外边拿不到,只需要传入地址,就可以了,其实内部已经实现批量转换。
如果想单拿到批量转换的经纬度的话可以联系,看到的话,我会把jar包改动一下。
联系邮箱:[email protected] qq:359372593 很少登录,一般一月登几次
2.LocationAddress_Gps_SDK_lib首先里面的权限不能少,lib包里的不用动导进项目就ok。
3.Location_SDK_Test测试用例代码,需要申请百度key,sha1值+;+项目包名;代码里实现步骤很全。
package
com.cmcc.locationaddress_gps_sdk_test;
import
com.cmcc.location_gps_sdk.ILocationDetail;
import
com.cmcc.location_gps_sdk.ILocationManger;
import
com.cmcc.location_gps_sdk.IReferenceAddress;
import
com.cmcc.location_gps_sdk.SDKManager;
import
com.example.locationaddress_gps_sdk_test.R;
import
android.os.Bundle;
import
android.util.Log;
import
android.app.Activity;
public
class
MainActivity
extends
Activity {
private
ILocationManger iLtionMInstance;
@Override
protected
void
onCreate(Bundle savedInstanceState) {
super
.onCreate(savedInstanceState);
iLtionMInstance = SDKManager.getILocationMangerInstance(getApplicationContext());
iLtionMInstance.getCurrentLocation(iLocatDE);
setContentView(R.layout.activity_main);
testLocationAddress();
}
//拿到定位的城市
ILocationDetail iLocatDE =
new
ILocationDetail() {
public
void
getLocationDetial(String city) {
Log.i(
"tag"
,
"定位的城市"
+city);
}
};
//传递至转化成经纬度
private
void
testLocationAddress() {
//循环地址
for
(
int
i=
0
;i
{
String addressName = strArray[i];
Log.i(
"tag"
,
"地址"
+addressName);
iLtionMInstance.setDisList(addressName);
}
iLtionMInstance.getLocationByAdrdress(referCB);
}
//根据地址转换经纬度算出距离
IReferenceAddress referCB =
new
IReferenceAddress() {
@Override
public
void
getIReferenceAddress(
double
distance) {
Log.i(
"distance"
,
"距离-->"
+distance);
}
};
String[] strArray={
"北京市西城区宣武门西大2号"
,
"北京市西城区宣武门西大街28号"
,
"北京市朝阳区慧忠北里309-6号第5大道精品休闲购物广场B2层"
,
"北京市海淀区北安河路68号"
,
"北京市昌平区回龙观北店嘉园26号"
,
"北京市大兴区北程庄金星路"
,
" 北京市大兴区天宝园五里一区22号"
,
"北京市海淀区西三旗桥东"
,
"北京市朝阳区安定路甲3号"
,
" 北京市海淀区上地十街10号"
,
"北京市朝阳区慧忠北里309-6号第5大道精品休闲购物广场B2层"
,
"北京市海淀区怡美家园"
,
"北京市海淀区交通大学路"
,
"北京市海淀区交通大学路1号院"
,
"北京市丰台区北京西站南路168号513室"
,
"朝阳区崔各庄乡大望京村"
,
" 昌平科技园区星火街9号"
,
"北京市昌平区立汤路186号龙德广场五层"
,
"昌平区兴寿镇东营村上东路和上西路交叉口"
,
" 北京市朝阳区将台乡尚君庙28号"
,
"北京市昌平区南口镇马坊村"
,
"北京市昌平区于新庄路"
,
"北京市昌平区北七家镇政府街东"
,
"北京市西城区真武庙二条5号"
,
"北京西城区永安路175号"
,
" 西城区真武庙二条5号"
,
"北京市西城区复兴门外大街19号楼"
};
}
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
manifest
xmlns:android
=
"http://schemas.android.com/apk/res/android"
package
=
"com.cmcc.locationaddress_gps_sdk_test"
android:versionCode
=
"1"
android:versionName
=
"1.0"
>
<
uses-sdk
android:minSdkVersion
=
"8"
android:targetSdkVersion
=
"19"
/>
<
uses-permission
android:name
=
"android.permission.GET_ACCOUNTS"
/>
<
uses-permission
android:name
=
"android.permission.USE_CREDENTIALS"
/>
<
uses-permission
android:name
=
"android.permission.MANAGE_ACCOUNTS"
/>
<
uses-permission
android:name
=
"android.permission.AUTHENTICATE_ACCOUNTS"
/>
<
uses-permission
android:name
=
"com.android.launcher.permission.READ_SETTINGS"
/>
<
uses-permission
android:name
=
"android.permission.BROADCAST_STICKY"
/>
<
uses-permission
android:name
=
"android.permission.WRITE_SETTINGS"
/>
<
uses-permission
android:name
=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<
uses-permission
android:name
=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<
uses-permission
android:name
=
"android.permission.READ_CONTACTS"
/>
<
uses-permission
android:name
=
"android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
/>
<
user-permission
android:name
=
"androdid.permission.USER_PRESENT"
/>
<
uses-permission
android:name
=
"android.permission.ACCESS_COARSE_LOCATION"
>
uses-permission
>
<
uses-permission
android:name
=
"android.permission.ACCESS_FINE_LOCATION"
>
uses-permission
>
<
uses-permission
android:name
=
"android.permission.ACCESS_WIFI_STATE"
>
uses-permission
>
<
uses-permission
android:name
=
"android.permission.ACCESS_NETWORK_STATE"
>
uses-permission
>
<
uses-permission
android:name
=
"android.permission.CHANGE_WIFI_STATE"
>
uses-permission
>
<
uses-permission
android:name
=
"android.permission.READ_PHONE_STATE"
>
uses-permission
>
<
uses-permission
android:name
=
"android.permission.WRITE_EXTERNAL_STORAGE"
>
uses-permission
>
<
uses-permission
android:name
=
"android.permission.INTERNET"
/>
<
uses-permission
android:name
=
"android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
>
uses-permission
>
<
uses-permission
android:name
=
"android.permission.READ_LOGS"
>
uses-permission
>
<
application
android:allowBackup
=
"true"
android:icon
=
"@drawable/ic_launcher"
android:label
=
"@string/app_name"
android:theme
=
"@style/AppTheme"
>
<
meta-data
android:name
=
"com.baidu.lbsapi.API_KEY"
android:value
=
"B0VmM0G0rGu3cSPsfzjUfS7k"
/>
<
service
android:name
=
"com.baidu.location.f"
android:enabled
=
"true"
android:permission
=
"android.permission.BAIDU_LOCATION_SERVICE"
android:process
=
":remote"
>
<
intent-filter
>
<
action
android:name
=
"com.baidu.location.service_v2.4"
/>
intent-filter
>
service
>
<
activity
android:name
=
"com.cmcc.locationaddress_gps_sdk_test.MainActivity"
android:label
=
"@string/app_name"
>
<
intent-filter
>
<
action
android:name
=
"android.intent.action.MAIN"
/>
<
category
android:name
=
"android.intent.category.LAUNCHER"
/>
intent-filter
>
activity
>
application
>
manifest
>