csv2geojson
csv2geojson copied to clipboard
Numeric fields examples
I struggled to utilize the numeric fields option in JavaScript until I realized it needed to be entered as “numericFields”. Posting this here in case someone else finds themselves in my situation. Could be clarified in the documentation, or with an HTML example where a numericFields is identified.
Thanks this is a great bit of code 👍👍
Agree with you @intothenight. Just went through my own process to figure that out and just found out how to make it work. The additional comment I would add is that the expected value is not a list, but a string with the numeric field names separated by a comma ',' without any space, as this line of code suggests: https://github.com/mapbox/csv2geojson/blob/gh-pages/index.js#L106
An example can thus be:
csv2geojson.csv2geojson(csvString, {
latfield: 'LATFIELDNAME',
lonfield: 'LONFIELDNAME',
delimiter: ',',
numericFields: 'NUMFIELD1,NUMFIELD2'
}, function(err, data) {
});
I suggest to add this in the README file. Could send a pull request, but it seems there are not being processed? (there's still an old one in the list)