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

133
Views
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
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!