Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda