Search code examples
androidgoogle-mapsgeolocation

Get list of addresses for visible area (google maps v2)


We can get address by one location:

Observable<List<Address>> reverseGeocodeObservable = locationProvider
.getReverseGeocodeObservable(location.getLatitude(), location.getLongitude(), MAX_ADDRESSES);

reverseGeocodeObservable
.subscribeOn(Schedulers.io())               
.observeOn(AndroidSchedulers.mainThread())  
.subscribe(...);

Is the way to get addresses for LatLngBounds bounds = ThisApp.getGlobals().mMap.getProjection().getVisibleRegion().latLngBounds;?

If you know some libs, please write that names. Thanks.


Solution

  • The Google maps API does not support the issuance of addresses within the radius of the specified point. It provides information about places that an address can have. Therefore, the only way is to divide the selected area into sectors with a radius of the inscribed circle equal to 100 meters. I implemented such an algorithm and it will very long be performed for one area (about 2 weeks) if run on a mobile device. On the server it will be very fast. But the essence remains the same - for one area we will get 4.5 billion points, according to which we need to get data from Google and SQLite's file for one area has a size = 1,5 Gb. For three areas (the whole map), it will be 4.5 billion * 3. Can you imagine how much this is? At one key, Google issues a quota of up to 150,000 requests. In general, this is a time-consuming issue and it is better not to put it in priority, but to look for another way.