Commit d73ac168 authored by Rodrigo Tapia-McClung's avatar Rodrigo Tapia-McClung

Fix split station data with \r\n or \n

parent 4374ac3e
...@@ -28,7 +28,7 @@ fetch(`${baseUrl}/data/cdmx.geojson`) ...@@ -28,7 +28,7 @@ fetch(`${baseUrl}/data/cdmx.geojson`)
// Read and parse csv station data // Read and parse csv station data
fetch(`${baseUrl}/data/cat_estacion.csv`) fetch(`${baseUrl}/data/cat_estacion.csv`)
.then(response => response.arrayBuffer()) .then(response => response.arrayBuffer())
.then(d => new TextDecoder("iso-8859-1").decode(d).split("\r\n")) .then(d => new TextDecoder("iso-8859-1").decode(d).split(/\r\n|\n|\r/))
.then(d => { // arrange elements as a decent array .then(d => { // arrange elements as a decent array
let array = []; let array = [];
d.forEach( d => array.push(d.split(","))); d.forEach( d => array.push(d.split(",")));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment