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

296
Views
Arc.js not drawing line in OpenLayers 6

my code is

    const testSource = new VectorSource({
      loader: () => {
        const start2 = { x: 43.449928, y: 39.956589 };
        const end2 = { x: 55.606186, y: 49.278728 };

        const generator = new arc.GreatCircle(start2, end2);


        const line = generator.Arc(100, { offset: 10 });
        const features = [];
        line.geometries.forEach((geometry) => {
          const line = new LineString(geometry.coords);
          line.transform('EPSG:4326', 'EPSG:3857');
          const style = new Style({
            stroke: new Stroke({
              color: '#EAE911',
              width: 2,
            }),
          });

          features.push(new Feature({ geometry: line }));

          features.forEach((feature) => {
            feature.setStyle(style);
            testSource.addFeature(feature);
          });
        });
      },
    });

    const vectorLineLayer = new VectorLayer({
      className: 'drawing-layer',
      source: testSource,
    });
    mapReference.addLayer(vectorLineLayer);

I can see that the source exists inside my layer but it will not draw no matter what I do, any ideas? It's not a zIndex issue because I have my vectorLayer CSS set zIndex.

EDIT 5/2/2022 turns out this line was giving me issues,

line.transform('EPSG:4326', 'EPSG:3857');

it was somehow turning my flat coordinates into insane lat/lon. deleting it now shows my curved lines

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!