Search in sources :

Example 1 with GeocodeSearch

use of com.amap.api.services.geocoder.GeocodeSearch in project SmartMesh_Android by SmartMeshFoundation.

the class LoadDataService method onCreate.

@Override
public void onCreate() {
    geocoderSearch = new GeocodeSearch(this);
    geocoderSearch.setOnGeocodeSearchListener(this);
    super.onCreate();
}
Also used : GeocodeSearch(com.amap.api.services.geocoder.GeocodeSearch)

Example 2 with GeocodeSearch

use of com.amap.api.services.geocoder.GeocodeSearch in project summer-android by cn-cerc.

the class ClockInActivity method setUpMap.

private void setUpMap() {
    aMap.setMapType(3);
    // 设置定位监听
    aMap.setLocationSource(this);
    // 设置默认定位按钮是否显示
    aMap.getUiSettings().setMyLocationButtonEnabled(true);
    // 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
    aMap.setMyLocationEnabled(true);
    // 设置定位的类型为定位模式 ,可以由定位、跟随或地图根据面向方向旋转几种
    aMap.setMyLocationType(1);
    CameraPosition LUJIAZUI = new CameraPosition.Builder().target(new LatLng(22.579652, 113.861323)).zoom(17).bearing(0).tilt(45).build();
    aMap.animateCamera(CameraUpdateFactory.newCameraPosition(LUJIAZUI));
    setupLocationStyle();
    aMap.setOnMapClickListener(this);
    aMap.moveCamera(CameraUpdateFactory.zoomTo(18));
    geocoderSearch = new GeocodeSearch(this);
    geocoderSearch.setOnGeocodeSearchListener(this);
    progDialog = new ProgressDialog(this);
}
Also used : CameraPosition(com.amap.api.maps2d.model.CameraPosition) GeocodeSearch(com.amap.api.services.geocoder.GeocodeSearch) LatLng(com.amap.api.maps2d.model.LatLng) ProgressDialog(android.app.ProgressDialog)

Example 3 with GeocodeSearch

use of com.amap.api.services.geocoder.GeocodeSearch in project KL2 by jweihao.

the class GaoDeActivity method getAddressInfoByLatLong.

/**
 * 通过经纬度获取当前地址详细信息,逆地址编码
 *
 * @param latitude
 * @param longitude
 */
private void getAddressInfoByLatLong(double latitude, double longitude) {
    GeocodeSearch geocodeSearch = new GeocodeSearch(this);
    /*
        point - 要进行逆地理编码的地理坐标点。
        radius - 查找范围。默认值为1000,取值范围1-3000,单位米。
        latLonType - 输入参数坐标类型。包含GPS坐标和高德坐标。 可以参考RegeocodeQuery.setLatLonType(String)
        */
    RegeocodeQuery query = new RegeocodeQuery(new LatLonPoint(latitude, longitude), 3000, GeocodeSearch.AMAP);
    geocodeSearch.getFromLocationAsyn(query);
    geocodeSearch.setOnGeocodeSearchListener(mOnGeocodeSearchListener);
}
Also used : GeocodeSearch(com.amap.api.services.geocoder.GeocodeSearch) RegeocodeQuery(com.amap.api.services.geocoder.RegeocodeQuery) LatLonPoint(com.amap.api.services.core.LatLonPoint)

Example 4 with GeocodeSearch

use of com.amap.api.services.geocoder.GeocodeSearch in project YourEyes by SevenLJY.

the class MyLocationActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_mylocation);
    longitude = -1;
    btn_getLocation = (Button) findViewById(R.id.btn_getLocation);
    tv_location = (TextView) findViewById(R.id.tv_location);
    et_destinationName = (EditText) findViewById(R.id.et_destinationName);
    btn_toNavi = (Button) findViewById(R.id.btn_toNavi);
    tv_destination = (TextView) findViewById(R.id.tv_destination);
    dest_longitude = 0;
    dest_latitude = 0;
    //初始化定位和地址解析
    initLocation();
    search = new GeocodeSearch(this);
    search.setOnGeocodeSearchListener(new GeocodeSearch.OnGeocodeSearchListener() {

        @Override
        public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
        // RegeocodeAddress addr = regeocodeResult.getRegeocodeAddress();
        }

        @Override
        public void onGeocodeSearched(GeocodeResult geocodeResult, int i) {
            GeocodeAddress addr = geocodeResult.getGeocodeAddressList().get(0);
            LatLonPoint latlng = addr.getLatLonPoint();
            dest_longitude = latlng.getLongitude();
            dest_latitude = latlng.getLatitude();
            String temp = "";
            temp += "经度:" + dest_longitude + "\n";
            temp += "纬度:" + dest_latitude + "\n";
            tv_destination.setText(temp);
        }
    });
    btn_getLocation.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            startLocation();
        }
    });
    btn_toNavi.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            destinationName = et_destinationName.getText().toString().trim();
            if (destinationName.equals("")) {
                ToastUtil.show(MyLocationActivity.this, "请输入有效地址");
            } else {
                if (city != null) {
                    GeocodeQuery query = new GeocodeQuery(destinationName, city);
                    search.getFromLocationNameAsyn(query);
                }
            }
        }
    });
}
Also used : GeocodeAddress(com.amap.api.services.geocoder.GeocodeAddress) GeocodeSearch(com.amap.api.services.geocoder.GeocodeSearch) RegeocodeResult(com.amap.api.services.geocoder.RegeocodeResult) GeocodeResult(com.amap.api.services.geocoder.GeocodeResult) LatLonPoint(com.amap.api.services.core.LatLonPoint) TextView(android.widget.TextView) View(android.view.View) LatLonPoint(com.amap.api.services.core.LatLonPoint) GeocodeQuery(com.amap.api.services.geocoder.GeocodeQuery)

Aggregations

GeocodeSearch (com.amap.api.services.geocoder.GeocodeSearch)4 LatLonPoint (com.amap.api.services.core.LatLonPoint)2 ProgressDialog (android.app.ProgressDialog)1 View (android.view.View)1 TextView (android.widget.TextView)1 CameraPosition (com.amap.api.maps2d.model.CameraPosition)1 LatLng (com.amap.api.maps2d.model.LatLng)1 GeocodeAddress (com.amap.api.services.geocoder.GeocodeAddress)1 GeocodeQuery (com.amap.api.services.geocoder.GeocodeQuery)1 GeocodeResult (com.amap.api.services.geocoder.GeocodeResult)1 RegeocodeQuery (com.amap.api.services.geocoder.RegeocodeQuery)1 RegeocodeResult (com.amap.api.services.geocoder.RegeocodeResult)1