Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
Not able to draw arc between 2 points in Openlayer

I have 2 points on canvas. Lets say point-A [x=4.1549997, y=4.005] and Point-B [x=2.77, y=3.5749998]

Now, I want to draw an arc arrow from Point-A > Point-B AND Point-B > Point-A using OpenLayers 3 Library.

So far, I have been able to successfully create Straight Arrows using LineString. But, I could not find any inbuilt functionality given by OpenLayer to draw ARC between 2 points.

      var me = this;
  var line = new ol.geom.LineString(coordinate);

  var fl = new ol.Feature({
      name: "line",
      geometry: line
    });

     
  fl.setProperties({
      'coordinate': coordinate
    });
    fl.setStyle( function(feature, resolution) {
      return me.getStyles(fl);
    });
  return fl;
  
  
  
  
  
  
  getStyles: function (fObj) {
    var geometry = fObj.getGeometry();

    var styles = [new ol.style.Style({
        stroke: new ol.style.Stroke({
           width: 5,
           color: 'rgb(21,150,18)',
           lineDash: [.2,5]
         })
       })];
    
    geometry.forEachSegment(function(start, end) {
        var dx = end[0] - start[0];
        var dy = end[1] - start[1];
        var rotation = Math.atan2(dy, dx);
        styles.push(new ol.style.Style({
          geometry: new ol.geom.Point(end),
          image: new ol.style.Icon({
            src: '../images/arrow_test.png',
            anchor: [0.75, 0.5],
            rotateWithView: true,
            rotation: -rotation
          })
        }));
      })
    
    return styles;
},

Can anyone please help me here regarding this ?

Note - Also, there is one more thing which I am concerned also. When multiple ARCs are drawn between Point-A and Point-B, then they should not overlap on each other.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!