我想显示计算出的路线(卡车)的地图。我怎样才能做到这一点? 当前显示的地图基于纬度和经度,而不是基于计算出的路线。
答案 0 :(得分:0)
如果您要显示带有折线(路线)的地图,则可以使用以下两种解决方案之一:
`
function addPolylineToMap(map) {
var lineString = new H.geo.LineString();
lineString.pushPoint({lat:53.3477, lng:-6.2597});
lineString.pushPoint({lat:51.5008, lng:-0.1224});
lineString.pushPoint({lat:48.8567, lng:2.3508});
lineString.pushPoint({lat:52.5166, lng:13.3833});
map.addObject(new H.map.Polyline(
lineString, { style: { lineWidth: 4 }}
));
}
`
2. 地图图像API :将应用ID和应用代码值替换为实际值。请访问developer.here.com/api-explorer/rest/map-image/map-image-with-routes
GET https://image.maps.api.here.com/mia/1.6/route?r0=52.5338%2C13.2966%2C52.538361%2C13.325329&r1=52.540867%2C13.262444%2C52.536691%2C13.264561%2C52.529172%2C13.268337%2C52.528337%2C13.273144%2C52.52583%2C13.27898%2C52.518728%2C13.279667&m0=52.5338%2C13.2966%2C52.538361%2C13.325329&m1=52.540867%2C13.262444%2C52.518728%2C13.279667&lc0=00ff00&sc0=000000&lw0=6&lc1=ff0000&sc1=0000ff&lw1=3&w=500&app_id=xxxx&app_code=xxxxx