I recently switched from the Here Routing API v7 to the v8 version, and after struggling to change all of the javascript code since it differs so much from the previous version, I discovered that the v8 version returns a Flexibe Polyline that is 4 times greater (in MBytes) than the v7 version.
The response is handled as follows in the Here API Routing v7 Javascript code:
var lineString = new H.geo.LineString(), routeShape = route.shape, polyline;
routeShape.forEach(function(point) {
var parts = point.split(',');
lineString.pushLatLngAlt(parts[0], parts[1], 0);
});
var polylineRoute = new H.map.Polyline(lineString, {
style : {
lineWidth : 4,
strokeColor : 'rgba(103, 117, 191, 1)'
}
});
The variable "polylineRoute" has a content size of approximately 515 KB, covering a distance of 2608.35 km.
However, the size of the v8 version is 2065 KB!
The sample code for the eighth version is provided below:
if (route.sections.length) {
let lineStringArray = [];
route.sections.forEach((section) => {
// Create a linestring to use as a point source for the route line
lineStringArray.push(H.geo.LineString.fromFlexiblePolyline(section.polyline));
});
let multiLineString = new H.geo.MultiLineString(lineStringArray);
}
Is there a way to make the V8 version of the Routing API's polyline response smaller?
Thank you.