Javascript 此处使用反向地理编码/Nokia地图
我正在尝试实现here map(asp.net web app)的新结构,但是,我看不到通过javascript传递位置信息和检索特定地址并在标记上粘贴气泡信息的功能 感谢您的建议。Javascript 此处使用反向地理编码/Nokia地图,javascript,map,here-api,Javascript,Map,Here Api,我正在尝试实现here map(asp.net web app)的新结构,但是,我看不到通过javascript传递位置信息和检索特定地址并在标记上粘贴气泡信息的功能 感谢您的建议。 干杯我想您正在寻找多个并发反向地理编码请求。这样做没有问题,因为调用是异步的,所以您只需统计哪些请求已完成,并在最后调用一次“完成后执行”的内容: e、 g: 使用回调函数,如图所示: function processResults(data, requestStatus) { if (req
干杯我想您正在寻找多个并发反向地理编码请求。这样做没有问题,因为调用是异步的,所以您只需统计哪些请求已完成,并在最后调用一次“完成后执行”的内容: e、 g: 使用回调函数,如图所示:
function processResults(data, requestStatus) {
if (requestStatus == "OK") {
// if we are finished, we add a marker for the mapped position
var marker = new nokia.maps.map.StandardMarker(data.location[0].position);
marker.content = data.location[0].address.text; // add your content here
addressContainer.objects.add(
marker);
//increment the counter to notify another manager has finished
managersFinished++;
} else if(requestStatus === "ERROR") {
// we'll also increment in case of an error
managersFinished++;
}
// if all managers are finished, we call the final function
if(managersFinished === latLngs.length) {
onAllManagersFinished();
}
}
最后的清理工作:
function onAllManagersFinished() {
//we get the bounding box of the container
var bbox = addressContainer.getBoundingBox();
// if the bounding box is null then there are no objects inside
// meaning no markers have been added to it
if (bbox != null) {
// we have at least one address mapped
// so we add the container and zoomTo it
map.objects.add(addressContainer);
map.zoomTo(bbox);
} else {
// otherwise we'll pop up an error message
alert("There are no addresses to show :(");
}
}
此外,您还可以在容器上添加一个事件处理程序,它可以打开所有位置的InfoBubble:
addressContainer.addListener(
"click",
function (evt) {
infoBubbles.openBubble(evt.target.content, // content is your own stuff...
evt.target.coordinate);
}
);
如果在反向地理编码时需要传递更多信息,可以按照问题中描述的方式进行
可以找到类似问题(多个地理编码请求)的解决方案 对不起,完全不清楚你在问什么。你尝试过什么,你遇到了什么问题?这是关于位置属性的问题-已经完成了。但是,我当前的问题是,如何多次调用reverseGeoCode方法,以便在地图上有更多地址为气泡的标记?我无法循环:map.addListener(“displayready”,函数(){searchManager.reverseGeoCode({latitude:reverseGeoDeterm.latitude,longitude:reverseGeoDeterm.longitude,onComplete:processResults};});因为我有更多的时间
addressContainer.addListener(
"click",
function (evt) {
infoBubbles.openBubble(evt.target.content, // content is your own stuff...
evt.target.coordinate);
}
);