function addRouteShapeToMap(route) {
		route.sections.forEach((section) => {
			// decode LineString from the flexible polyline
			let linestring = H.geo.LineString.fromFlexiblePolyline(section.polyline);

			// Create a polyline to display the route:
			let polyline = new H.map.Polyline(linestring, {
				style: {
					lineWidth: 4,
					strokeColor: 'rgba(0, 128, 255, 0.7)',
				},
			});

			polyline.id = 'route';
			// Add the polyline to the map
			map.addObject(polyline);
			// And zoom to its bounding rectangle
			map.getViewModel().setLookAtData(
				{
					bounds: polyline.getBoundingBox(),
				},
				true
			);
		});
	}
// Function to add the lines for the directions
Function to add the lines for the directions
Function to add the lines for the directions
function addRouteShapeToMap(route) {
		route.sections.forEach((section) => {
			let linestring = H.geo.LineString.fromFlexiblePolyline(section.polyline);
			let polyline = new H.map.Polyline(linestring, {
				style: {
					lineWidth: 4,
					strokeColor: 'rgba(0, 128, 255, 0.7)',
				},
			});
			polyline.id = 'route';
			map.addObject(polyline);
			map.getViewModel().setLookAtData(
				{
					bounds: polyline.getBoundingBox(),
				},
				true
			);
		});
	}
function addRouteShapeToMap ( route ) { route . sections . forEach ( ( section ) => { let linestring = H . geo . LineString . fromFlexiblePolyline ( section . polyline ) ; let polyline = new H . map . Polyline ( linestring , { style : { lineWidth : 4 , strokeColor : 'rgba(0, 128, 255, 0.7)' , } , } ) ; polyline . id = 'route' ; map . addObject ( polyline ) ; map . getViewModel ( ) . setLookAtData ( { bounds : polyline . getBoundingBox ( ) , } , true ) ; } ) ; }
Function to add the lines for the directions
Function to add the lines for the directions
// decode LineString from the flexible polyline // Create a polyline to display the route: // Add the polyline to the map // And zoom to its bounding rectangle