Java Android MapBox反向地理编码
我正在使用android的MapBox我正在尝试使用地理编码MapBox服务,以下是反向地理编码请求和响应的代码:Java Android MapBox反向地理编码,java,android,mapbox,reverse-geocoding,mapbox-android,Java,Android,Mapbox,Reverse Geocoding,Mapbox Android,我正在使用android的MapBox我正在尝试使用地理编码MapBox服务,以下是反向地理编码请求和响应的代码: MapboxGeocoding reverseGeocode = MapboxGeocoding.builder() .accessToken("access token secret code") .query(Point.fromLngLat(14.6937, -17.44406))
MapboxGeocoding reverseGeocode = MapboxGeocoding.builder()
.accessToken("access token secret code")
.query(Point.fromLngLat(14.6937, -17.44406))
.geocodingTypes(GeocodingCriteria.TYPE_ADDRESS)
.build();
reverseGeocode.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();
for (int i = 0;i<results.size();i++){
System.out.println(results.get(i));
}
} else {
// No result for your request were found.
Log.e( "onResponse:"," No result found");
}
}
@Override
public void onFailure(Call<GeocodingResponse> call, Throwable throwable) {
throwable.printStackTrace();
}
});
MapboxGeocoding reverseGeocode=MapboxGeocoding.builder()
.accessToken(“访问令牌密码”)
.查询(点源于LNGLAT(14.6937,-17.44406))
.geocodingTypes(GeocodingCriteria.TYPE_地址)
.build();
reverseGeocode.enqueueCall(新回调(){
@凌驾
公共void onResponse(调用、响应){
列表结果=response.body().features();
如果(results.size()>0){
//记录第一个结果点。
Point firstResultPoint=results.get(0.center();
对于(int i=0;我为什么要向全世界展示你的秘密访问令牌呢?你为什么不使用本机的、经过良好测试的Google的Geocoder类?你有没有明确的理由不这样做?对不起,这是一个错误,我不使用Google地图,因为它不是freeMapbox,也不是完全免费的,它们只有一个免费层。