Im trying reverse geocoding example on mapbox
Everything's working fine. But the problem is when i replace my current location it doesnt return a result. I think that mapbox doesnt have much data about my region (Im in Vietnam). Is there anyway to add my own places supposed that I had a dataset of coordinate and address
My code:
mapboxGeocoding = MapboxGeocoding.builder()
.accessToken(getString(R.string.mapbox_access_token))
.query(Point.fromLngLat(106.799142,10.875838))
.geocodingTypes(GeocodingCriteria.TYPE_ADDRESS)
.build();;
mapboxGeocoding.enqueueCall(new Callback<GeocodingResponse>() {
@Override
public void onResponse(Call<GeocodingResponse> call, Response<GeocodingResponse> response) {
List<CarmenFeature> results = response.body().features();
if (results.size() > 0) {
// Log the first results Point.
//Point firstResultPoint = results.get(0).center();
String country=results.get(0).placeName();
Log.d("Geocoding",country);
} else {
// No result for your request were found.
Toast.makeText(getApplicationContext(), "onResponse: No result found", Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure(Call<GeocodingResponse> call, Throwable throwable) {
throwable.printStackTrace();
}
});
}
@Override
protected void onDestroy(){
super.onDestroy();
mapboxGeocoding.cancelCall();
}