Tag: google geolocation

创build一个callback函数返回一个数组

我正在学习Node.js 我在创build自己的函数时遇到了麻烦。 这似乎是这样一个简单的事情,但我不太明白如何做到这一点。 该函数传递一个地址(例如:“1234 will ln,co”),该地址使用google的geolocate json api返回数组中的完整地址,纬度和经度。 这是我的代码: //require secure http module var https = require("https"); //My google API key var googleApiKey = "my_private_api_key"; //error function function printError(error) { console.error(error.message); } function locate(address) { //accept an address as an argument to geolocate //replace spaces in the address string with + charectors to make string […]