2016-09-23 130 views
0

我得到了答案從stackoverflow java reverse code to get address from lattitude and longitude。但在這個問題的答案我不能訪問packege GeoApi背景下,GeocodingResult,GeocodingApi.I我寫的Java Web application.could誰能告訴我什麼是packege或jar文件我下載到包括那些packege 我的答案代碼是java反向代碼從經度和緯度獲取地址

GeoApiContext gtx = new GeoApiContext().setApiKey("**<<<<your-key-here>>>>**"); 
try { 
    GeocodingResult[] gResp = GeocodingApi.newRequest(gtx) 
     .latlng(new LatLng(37, -121)).await(); 
    System.out.println(gResp[0].formattedAddress); 
} catch (Exception e) { 
    // TODO Auto-generated catch block 
    e.printStackTrace(); 
} 
+0

https://github.com/googlemaps/google-maps-services-java – shmosel

回答

1

如果你想下載的罐子,你可以做到這一點上mvnrepository.comgoogle-maps-services-0.1.15.jar

Maven的

如果您正在使用maven這裏的座標:

<dependency> 
    <groupId>com.google.maps</groupId> 
    <artifactId>google-maps-services</artifactId> 
    <version>0.1.15</version> 
</dependency> 

更多的信息,你會發現這裏:developers.google.com

+0

但我得到一個錯誤,因爲找不到符號:LatLng – vignesh

+0

@vignesh你會在包中找到它:'com.google.maps.model' – dit