问题描述
我正在尝试使用 mapkit js 在苹果地图上绘制折线。无法在地图上显示任何内容。
我的项目由地图上的许多位置组成。所有标记都在地图上,点击一个标记将打开信息窗口并在地图上绘制一条折线。
map = new mapkit.Map("map");
function plottrailsCompound(data,map){
if(data.reststatus.status == "OK"){
if(annotations){
map.removeAnnotations(annotations);
annotations = [];
}
var landmarkAnnotationCallout = {
calloutElementForAnnotation: function(annotation) {
var cccDiv = calloutForLandmarkAnnotation(annotation,map);
return cccDiv;
},calloutAppearanceAnimationForAnnotation: function(annotation) {
return "scale-and-fadein .4s 0 1 normal cubic-bezier(8,1,1.5)";
}
};
}
}
function calloutForLandmarkAnnotation(data,map){
DrawPolyLine(map);
}
function DrawPolyLine(map){
var points = [[37.73438,-119.56517],[37.73435,-119.56513],[37.73431,-119.56509]];
var coords = points.map(function(point) {
return new mapkit.Coordinate(point[0],point[1]);
});
var style = new mapkit.Style({
lineWidth: 2,lineJoin: "round",lineDash: [8,4],strokeColor: "#F0F"
});
var polyline = new mapkit.PolylineOverlay(coords,{ style: style });
map.addOverlay(polyline);
}
我正在 calloutForLandmarkAnnotation
中绘制我的信息窗口,这里没有显示。 DrawPolyLine
函数有 points 变量,它有三个坐标,但实际上我有更多。有些有大约 100 个坐标。如果你们需要任何其他信息来解决这个问题,请告诉我。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)