2

There is no attributes or properties in the HERE map documentation related to creating a curved line between 2 points on map.

enter image description here Something like this I want to achieve in HERE maps

1 Answers1

0

There is no any straight way, but you can use following formula:

var D2R = Math.PI / 180;
var R2D = 180 / Math.PI;

var Coord = function(lon, lat) {
    this.lon = lon;
    this.lat = lat;
    this.x = D2R * lon;
    this.y = D2R * lat;
};

Coord.prototype.view = function() {
    return String(this.lon).slice(0, 4) + ',' + String(this.lat).slice(0, 4);
};

Coord.prototype.antipode = function() {
    var anti_lat = -1 * this.lat;
    var anti_lon = (this.lon < 0) ? 180 + this.lon : (180 - this.lon) * -1;
    return new Coord(anti_lon, anti_lat);
};

var LineString = function() {
    this.coords = [];
    this.length = 0;
};

LineString.prototype.move_to = function(coord) {
    this.length++;
    this.coords.push(coord);
};

var Arc = function(properties) {
    this.properties = properties || {};
    this.geometries = [];
};

Arc.prototype.json = function() {
    if (this.geometries.length <= 0) {
        return { 'geometry': { 'type': 'LineString', 'coordinates': null }, 'type': 'Feature', 'properties': this.properties };
    } else if (this.geometries.length == 1) {
        return { 'geometry': { 'type': 'LineString', 'coordinates': this.geometries[0].coords }, 'type': 'Feature', 'properties': this.properties };
    } else {
        var multiline = [];
        for (var i = 0; i < this.geometries.length; i++) {
            multiline.push(this.geometries[i].coords);
        }
        return { 'geometry': { 'type': 'MultiLineString', 'coordinates': multiline }, 'type': 'Feature', 'properties': this.properties };
    }
};

Arc.prototype.strip = function() {
    var s = H.geo.Strip ? new H.geo.Strip() : new H.geo.LineString();
    for (var i = 0; i < this.geometries.length; i++) {
        if (this.geometries[i].coords.lenght !== 0) {
            var coords = this.geometries[i].coords;
            for (var j = 0; j < coords.length; j++) {
                var p = new H.geo.Point(coords[j][1], coords[j][0]);
                s.pushPoint(p);
            }
        }
    }
    return s;
}

For detailed example, I have created a sample, please check - https://demo.support.here.com/examples/v3.1/geodesic_polyline