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

134
Visualizações
Using Papa parse to parse csv into GeoJSON but coordinates in FeatureCollection are undefined

I'm currently developing a small web-application where I need to parse a csv into a GeoJSON. Therefore I use Papaparse. Whenever I parse the csv document, everything works but the coordinates in the geoJSON are undefined. I first thought it may not be able to access the s_lon, s_lat fields in the result after parsing the csv, but that's not the case, they can be perfectly accessed as can be seen in the logging. But it becomes even weirder, when I try to hard-code the coordinates in the coordinates array, they're undefined as well whenever the Feature get's returned. Does anyone has an idea where the problem might come from?

csvToGeojson(csvString) {
      var self = this;
      self.$papa.parse(csvString, {
        // download: true,
        header: true,
        dynamicTyping: true,
        skipEmptyLines: true,
        complete: function (results) {
          var geoJsonFeatureCollection = {
            type: 'FeatureCollection',
            features: results.data.map(function(datum) {
              console.log(datum);
              console.log(datum.s_lon, datum.s_lat);
              return {
                type: 'Feature',
                geometry: {
                  type: 'Point',
                  coordinates: [datum.s_lon, datum.s_lat]
                },
                properties: datum
              }
            })
          };

          console.log("geoJsonFeatureCollection:")
          console.log(geoJsonFeatureCollection);
          self.$parent.addLayer(L.GeoJSON.canvasFlowmapLayer(geoJsonFeatureCollection, self.options));
        }
      })
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