Java Yelp搜索API无业务坐标
我正在使用开发一个移动应用程序。我想在谷歌地图上显示几个企业。 但不幸的是,在我的业务中,我没有收到坐标对象的所有信息Java Yelp搜索API无业务坐标,java,api,location,coordinate,yelp,Java,Api,Location,Coordinate,Yelp,我正在使用开发一个移动应用程序。我想在谷歌地图上显示几个企业。 但不幸的是,在我的业务中,我没有收到坐标对象的所有信息 "location":{ "neighborhoods":[ "West Ham", "Stratford" ], "state_code":"XGL", "display_address":[ "409 High Street", "We
"location":{
"neighborhoods":[
"West Ham",
"Stratford"
],
"state_code":"XGL",
"display_address":[
"409 High Street",
"West Ham",
"London E15 4QZ",
"UK"
],
"coordinate":{
"longitude":-2.16E-4,
"latitude":51.53907
},
"address":[
"409 High Street"
],
"postal_code":"E15 4QZ",
"geo_accuracy":5,
"country_code":"GB",
"city":"London"
},
我该如何面对这个问题?是否有在地图上显示我的业务的漫游 我刚刚找到了问题的答案 如果没有提供坐标,我可以使用 在格式化我的请求时,如下所示:
// Replace the API key below with a valid API key.
GeoApiContext context = new GeoApiContext().setApiKey("AIza...");
GeocodingResult[] results = GeocodingApi.geocode(context,
"1600 Amphitheatre Parkway Mountain View, CA 94043").await();
System.out.println(results[0].formattedAddress);
这类似于:
API返回给我一个JSON:
{
"results" : [
{
"address_components" : [
{
"long_name" : "54",
"short_name" : "54",
"types" : [ "street_number" ]
},
{
"long_name" : "Frith Street",
"short_name" : "Frith St",
"types" : [ "route" ]
},
{
"long_name" : "Soho",
"short_name" : "Soho",
"types" : [ "neighborhood", "political" ]
},
{
"long_name" : "Soho",
"short_name" : "Soho",
"types" : [ "sublocality_level_1", "sublocality", "political" ]
},
{
"long_name" : "London",
"short_name" : "London",
"types" : [ "locality", "political" ]
},
{
"long_name" : "London",
"short_name" : "London",
"types" : [ "postal_town" ]
},
{
"long_name" : "Greater London",
"short_name" : "Gt Lon",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "United Kingdom",
"short_name" : "GB",
"types" : [ "country", "political" ]
},
{
"long_name" : "W1D 4SL",
"short_name" : "W1D 4SL",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "54 Frith Street, Soho, London W1D 4SL, UK",
"geometry" : {
"location" : {
"lat" : 51.5137474,
"lng" : -0.1318321
},
"location_type" : "ROOFTOP",
"viewport" : {
"northeast" : {
"lat" : 51.5150963802915,
"lng" : -0.130483119708498
},
"southwest" : {
"lat" : 51.5123984197085,
"lng" : -0.133181080291502
}
}
},
"types" : [ "street_address" ]
}
],
"status" : "OK"
}
希望它能在这种情况下帮助其他人 除了这个事实,不管你用什么库来打印,这都是把数字转换成科学符号,还有什么遗漏?看起来你可以用你在那里的东西展示很多东西。