Just noticed this could be a little confusing. I was testing some CSV and noticed the list needs to be delimited using whatever else the csv is using.
parent
ccd280ae52
commit
16ecda3c8f
1 changed files with 4 additions and 2 deletions
|
@ -9,13 +9,15 @@ For more details on the motivations and design of this plugin see: https://githu
|
|||
Details on auto-detection:
|
||||
|
||||
### headers
|
||||
The plugin requires headers be present that give each column a name. It will parse the first line of the file as headers. If the first line is not actually headers then parsing behavior will be unpredictable because the plugin makes no attempt to detect whether the first line is pure data. You should ideally edit your CSV, adding headers if it does not have them. For cases where the CSV file may be very large or it is not feasible to add headers, then the plugin can be asked to dynamically accept them. Simply pass the option called `headers`, providing a comma delimited list of names like: `headers=x,y,name`. This would work for a csv file lacking headers like:
|
||||
The plugin requires headers be present that give each column a name. It will parse the first line of the file as headers. If the first line is not actually headers then parsing behavior will be unpredictable because the plugin makes no attempt to detect whether the first line is pure data. You should ideally edit your CSV, adding headers if it does not have them. For cases where the CSV file may be very large or it is not feasible to add headers, then the plugin can be asked to dynamically accept them. Simply pass the option called `headers`, providing a list of names separated by your delimiter of choice like: `headers=x,y,name`. This would work for a csv file lacking headers like:
|
||||
|
||||
```csv
|
||||
-122,48,Seattle
|
||||
0,51,London
|
||||
```
|
||||
|
||||
Or `headers=x|y|name` if your data is `|` delimited.
|
||||
|
||||
### file size
|
||||
|
||||
Because the plugin caches data in memory, large file sizes are not recommended. If your data is large, then please choose a more suitable format and then Mapnik can easily read data one row at a time. Because the CSV Plugin reads all data at initialization it makes an attempt to detect files over a certain size and will throw an error. The default threshold is 20 MB. This can be changed by passing the `filesize_max` option an alternative MB amount, but doing so is not recommended unless you are sure your machine has sufficient memory.
|
||||
|
@ -34,4 +36,4 @@ The plugin defaults to assuming `\` is the escape character. So data like `"This
|
|||
|
||||
### quote character
|
||||
|
||||
The plugin defaults to assuming `"` is the quote character that lines needing quoted will be wrapped in. Therefore a line like `"Main street,USA"` would parse fine and the `,` inside would not be interpreted as a column separator, but `'Main street, USA'` would not parse unless you passed a custom option like `quote='`.
|
||||
The plugin defaults to assuming `"` is the quote character that lines needing quoted will be wrapped in. Therefore a line like `"Main street,USA"` would parse fine and the `,` inside would not be interpreted as a column separator, but `'Main street, USA'` would not parse unless you passed a custom option like `quote='`.
|
Loading…
Reference in a new issue