在我的应用程序中,当您单击地图上的一个点时,它会返回地址。例如:将对象地址转换为字符串
locator.on("location-to-address-complete", function(evt) {
if (evt.address.address) {
var address = evt.address.address;
var location = webMercatorUtils.geographicToWebMercator(evt.address.location);
console.log(address)
}
});
控制台显示:
Object {Address: "1029 W Cermak Rd", Neighborhood: null, City: "Chicago", Subregion: null, Region: "Illinois"…}
有没有办法将地址转换为字符串。基本上我只想: 1029 W Cermak路,芝加哥,伊利诺伊州。
谢谢。
因此,建立从目标...'的console.log(address.Address + “ ”+ address.City +“” + address.Region)' – epascarello