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

144
Views
Applying polyline GeoJSON to mapbox static image

I am trying to encode my coordinates to create a path on a static image at mapbox but not having much luck. I've come across polyline for mapbox, which encodes the string. I have the code below for that, it looks to encode it well as trying the decode provides the same data as it was prior to encoding.

I am struggling to apply this encoded value into a static image URL. My example is below that I got from using the sandbox at mapbox.

    var try_pl = polyline.fromGeoJSON({ 
    "type": "Feature",
    "geometry": {
        "type": "LineString",
        "coordinates": [[-1.344579141588271,50.96578555186369],[-1.344579141588271,50.96578555186369],[-1.3445547502500421,50.965788778896744],[-1.3436562521836555,50.96578967441579],[-1.343292475905947,50.96593329647221],[-1.344480288502918,50.96570042912521],[-1.3456999094209814,50.96563188136548],[-1.3456999094209814,50.96563188136548],[-1.3462368893716565,50.96537412247744],[-1.34585878242166,50.965208840366074],[-1.344928928122842,50.96514265049426],[-1.3451180392346376,50.9650540524098],[-1.3451180392346376,50.9650540524098],[-1.34461917570763,50.96528627800269]]
    },
    "properties": {
        "stroke": "#dc3545",
        "stroke-width": 2
    }
});
console.log(try_pl);

Provides me with: egavHrreG???E?qD[iAl@lFLrF??r@jB^kALyDPd@??o@cB

Initially tried this with mapbox but failed.

https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/path(egavHrreG???E?qD[iAl@lFLrF??r@jB^kALyDPd@??o@cB)/auto/300x200?access_token=[TOKEN]

Im wondering if possibly the issue is passing high accuracy coordinates might be the issue, to much for mapbox to handle?

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!