mbloch/mapshaper

How to deal with space in csv header

Closed this issue · 2 comments

How to make this command works:

-join PM_22_NB_010.csv keys='id,parcelle' calc='groupe_personne = collect(Groupe personne), forme_juridique = collect(Forme juridique abrégée), COUNT = count()' \

The problem is with the space in the collect command. I try with " or ' without any luck ;) And also like that:

-join PM_22_NB_010.csv keys='id,parcelle' calc='groupe_personne = collect(Groupe\ personne), forme_juridique = collect(Forme\ juridique\ abrégée), COUNT = count()' \

mbloch commented

The problem is this: mapshaper expressions use JavaScript, and groupe_personne = collect(Groupe personne) is not a valid JavaScript expression. To refer to fields with names that are not valid JavaScript variable names, such as "Groupe personne", you can do this: groupe_personne = collect(d["Groupe personne"]).

great thanks! It's working