com.amap.api.services.geocoder.RegeocodeQuery Java Examples

The following examples show how to use com.amap.api.services.geocoder.RegeocodeQuery. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReGeocoderActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
/**
 * 响应逆地理编码的批量请求
 */
private void getAddresses() {
	List<LatLonPoint> geopointlist = readLatLonPoints();
	for (final LatLonPoint point : geopointlist) {
		ThreadUtil.getInstance().execute(new Runnable() {
			@Override
			public void run() {
				try {
					RegeocodeQuery query = new RegeocodeQuery(point, 200,
							GeocodeSearch.AMAP);// 第一个参数表示一个Latlng,第二参数表示范围多少米,第三个参数表示是火系坐标系还是GPS原生坐标系
					RegeocodeAddress result = geocoderSearch.getFromLocation(query);// 设置同步逆地理编码请求

					if (result != null && result.getFormatAddress() != null) {
						aMap.addMarker(new MarkerOptions()
								.position(new LatLng(point.getLatitude(), point.getLongitude()))
								.title(result.getFormatAddress()));
					}
				} catch (AMapException e) {
					Message msg = msgHandler.obtainMessage();
					msg.arg1 = e.getErrorCode();
					msgHandler.sendMessage(msg);
				}
			}
		});
	}
}
 
Example #2
Source File: ReGeocoderActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 响应逆地理编码
 */
public void getAddress(final LatLonPoint latLonPoint) {
	showDialog();
	RegeocodeQuery query = new RegeocodeQuery(latLonPoint, 200,
			GeocodeSearch.AMAP);// 第一个参数表示一个Latlng,第二参数表示范围多少米,第三个参数表示是火系坐标系还是GPS原生坐标系
	geocoderSearch.getFromLocationAsyn(query);// 设置异步逆地理编码请求
}
 
Example #3
Source File: AutoScheduleAssistFragment.java    From BetterWay with Apache License 2.0 5 votes vote down vote up
@Override
public void onMyLocationChange(Location location) {
    LogUtil.e(TAG, "onMyLocationChange");
    GeocodeSearch geocoderSearch = new GeocodeSearch(getContext());
    geocoderSearch.setOnGeocodeSearchListener(this);
    LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
    aMap.moveCamera(CameraUpdateFactory.changeLatLng(latLng));
    LatLonPoint latLonPoint = new LatLonPoint(location.getLatitude(), location.getLongitude());
    RegeocodeQuery query = new RegeocodeQuery(latLonPoint, 10000, GeocodeSearch.AMAP);
    geocoderSearch.getFromLocationAsyn(query);
}
 
Example #4
Source File: AMAPLocationActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
    LatLonPoint point = new LatLonPoint(cameraPosition.target.latitude, cameraPosition.target.longitude);
    RegeocodeQuery query = new RegeocodeQuery(point, 50, GeocodeSearch.AMAP);
    geocodeSearch.getFromLocationAsyn(query);
    if (centerMarker != null) {
        animMarker();
    }
    showLocationView();
}
 
Example #5
Source File: AmapActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
    LatLonPoint point = new LatLonPoint(cameraPosition.target.latitude, cameraPosition.target.longitude);
    RegeocodeQuery query = new RegeocodeQuery(point, 50, GeocodeSearch.AMAP);
    geocodeSearch.getFromLocationAsyn(query);
    if (centerMarker != null) {
        animMarker();
    }
    showLocationView();
}
 
Example #6
Source File: WritePresenter.java    From Fishing with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(WriteActivity view, Bundle savedState) {
    super.onCreate(view, savedState);
    provider = new ImageProvider(getView());
    mGeocoderSearch = new GeocodeSearch(getView());
    mGeocoderSearch.setOnGeocodeSearchListener(this);
    location = LocationModel.getInstance().getCurLocation();
    if (location != null) {
        mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(location.getLatitude(), location.getLongitude()), 50, GeocodeSearch.AMAP));
    }
}
 
Example #7
Source File: PlaceLocationSelectActivity.java    From Fishing with GNU General Public License v3.0 5 votes vote down vote up
private void initMyPoint() {
    Location location = LocationModel.getInstance().getCurLocation();
    moveTo(location.getLatitude(), location.getLongitude(), 13);
    mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(location.getLatitude(), location.getLongitude()), 50, GeocodeSearch.AMAP));

    MarkerOptions markerOption = new MarkerOptions();
    markerOption.icon(BitmapDescriptorFactory
            .fromResource(R.drawable.location_marker));
    mMyLocation = aMap.addMarker(markerOption);
    mPoint = new LatLng(location.getLatitude(),location.getLongitude());
    LocationModel.getInstance().registerLocationChange(newLocation -> mMyLocation.setPosition(new LatLng(location.latitude,location.longitude)));
}
 
Example #8
Source File: PlaceLocationSelectActivity.java    From Fishing with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onMapClick(LatLng latLng) {
    if (mLastMarker != null) mLastMarker.destroy();
    mPoint = latLng;
    MarkerOptions markerOption = new MarkerOptions();
    markerOption.position(latLng);
    markerOption.icon(BitmapDescriptorFactory
            .fromResource(R.drawable.location_point_bigger_red));
    mLastMarker = aMap.addMarker(markerOption);
    mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(latLng.latitude,latLng.longitude), 50,GeocodeSearch.AMAP));
}
 
Example #9
Source File: PlaceLocationSelectActivity.java    From Fishing with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onMarkerClick(Marker marker) {
    if (marker.equals(mMyLocation)){
        if (mLastMarker != null) mLastMarker.destroy();
        mPoint = marker.getPosition();
        mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(marker.getPosition().latitude,marker.getPosition().longitude), 50,GeocodeSearch.AMAP));
    }
    return true;
}
 
Example #10
Source File: FlutterAMapConvertRegister.java    From flutter_amap_plugin with MIT License 4 votes vote down vote up
private void coordinateConvertToGeo(Coordinate coordinate) {
    RegeocodeQuery query = new RegeocodeQuery(new LatLonPoint(coordinate.latitude, coordinate.longitude), 200, GeocodeSearch.AMAP);
    geocoderSearch.getFromLocationAsyn(query);
}
 
Example #11
Source File: LocationActivity.java    From Socket.io-FLSocketIM-Android with MIT License 4 votes vote down vote up
private void searchLocationsName(LatLng latLng) {
    oldLocation = latLng;
    LatLonPoint point = new LatLonPoint(latLng.latitude, latLng.longitude);
    RegeocodeQuery query = new RegeocodeQuery(point, 1000, GeocodeSearch.AMAP);
    geocodeSearch.getFromLocationAsyn(query);
}
 
Example #12
Source File: RegeocodeTask.java    From Android_UsingCar_Example with Apache License 2.0 4 votes vote down vote up
public void search(double latitude, double longitude) {
	RegeocodeQuery regecodeQuery = new RegeocodeQuery(new LatLonPoint(
			latitude, longitude), SEARCH_RADIUS, GeocodeSearch.AMAP);
	mGeocodeSearch.getFromLocationAsyn(regecodeQuery);
}
 
Example #13
Source File: MapActivity.java    From xposed-rimet with Apache License 2.0 3 votes vote down vote up
private void geocodeAddress() {

        if (mSearchLatLonPoint == null) return;

        RegeocodeQuery query = new RegeocodeQuery(mSearchLatLonPoint, 2000, GeocodeSearch.AMAP);
        mGeocodeSearch.getFromLocationAsyn(query);
    }