Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

73
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda