[英]Google Maps API to get location address as well as domain information
我正在使用谷歌地圖 Javascript API 並使用地點庫。 雖然我能夠獲取位置地址,但我還需要獲取位置域信息,比如假設該位置是一家企業並且還有一個鏈接到該位置的網站 URL。 有人可以引導我到正確的 API 或也提供位置域信息的圖書館嗎? 到目前為止,我還沒有遇到任何。
也可以使用places
library 獲取其他信息
//make a request variable attaching the data you require , make sure to use only those which you require as detail request are billed separately
var request = {
query: 'yourquery',
fields: ['address_component', 'website']
};
service = new google.maps.places.PlacesService(map);
service.getDetails(request, callback);
//Here you get the result
function callback(place, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
var website = place.website; // get the website, may be empty
var type = place.address_component.types[0]; //this is an array and can be empty
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.