我有一个地址列表,我现在想要检索他们的经度和纬度.我想通过java使用谷歌地图api.我将如何为一个地址检索一组合作伙伴.(因为我可以轻松实现多个)
您也可以像这样使用Google Geocoder Java API GeoGoogle:
// Initialize a new GeoAddressStandardizer-class with your API-Key
GeoAddressStandardizer st = new GeoAddressStandardizer(apikey);
// Get a list of possible matching addresses
List<GeoAddress> addresses = st.standardizeToGeoAddresses(address);
// Get the first address (like you posted above)
GeoAddress address = addresses.get(0);
// Get the coordinates for the address
GeoCoordinate coords = address.getCoordinate();
// Longitude
double longitude = coords.getLongitude();
// Latitude
double latitude = coords.getLatitude();
Run Code Online (Sandbox Code Playgroud)