【发布时间】:2017-04-28 20:48:50
【问题描述】:
这里的地图 API 有问题。
我想为地图实现第一个默认位置。当用户搜索某个位置时,它应该移动到该位置。简单对。但我有点失落。
//i define parameter.
var geocodingParams = { searchText: 'location address' };
// Get an instance of the geocoding service:
var geocoder = platform.getGeocodingService();
// Call the geocode method with the geocoding parameters,
// the callback and an error callback function (called if a
// communication error occurs):
geocoder.geocode(geocodingParams, onResult, onError);
// results when success
function onResult(result) {
var locations = result.response.view[0].result;
alert(JSON.stringify(locations));
}
// on Error
function onError(e) {
alert(e);
}
它只给出错误。我们将不胜感激。
【问题讨论】:
标签: dictionary here-api geocode