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

66
Views
Rounding up coordinates from a geojson file for line plotting

I am trying to round up the coordinates in my file to 3 decimal places rather than the usual length they are normally at. I have been trying the ".toFixed(n)" method but with no results.

      //line css
      var lineStyle = {
        "color": "#ff3300",
        "weight": 1,
        "opacity": 0.5
      };

      //line display command
      var lineLayer = L.geoJSON(controlLines, function(feature, coordinates) {
        for (coordinates in feature) {
          return (+feature.coordinates).toFixed(3);
        }
      },
      {
        style: lineStyle
      }).addTo(map);

My data looks as so:

var controlLines = [
  {
     "geometry":{
        "type":"LineString",
        "coordinates":[
           [
              -3.231658,
              51.687026
           ],
           [
              -3.231659,
              51.687016
           ]
        ]
     },
     "type":"Feature",
     "properties":{
        "User_ID":1002848324
     }
  },
  {...}]

Any advice or answers would be greatly appreciated.

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!