8

I would like to know where I can find a list of parameters that can be specified when importing a CSV into QGIS using python. The documentation I've found only shows a few options.

QGIS Cookbook

I would like to specify the number of lines to skip, and the fields of the X and Y when there isn't a header. How do I find the complete list of options?

1
  • Bumping this to the top as I would still like to know the answer (3 years later)
    – cndnflyr
    Sep 13, 2021 at 17:48

1 Answer 1

10

Here are the parameters required while importing a delimited text file: (String values are usually case-insensitive. Yes, yes, YES are all valid)

key value(s)
crs e.g. epsg:4326, EPSG:3857
type csv/regexp/whitespace
delimiter <delimiter character(s) or regular expression>
xField <field name>
yField <field name>
zField <field name>
mField <field name>
spatialIndex yes/no/y/n
subsetIndex yes/no/y/n
watchFile yes/no/y/n
geomType none/point/line/polygon
wktField <wkt field name>
maxFields number
quote <quote character> e.g. "
escape <escape character> e.g. "
skipLines number
skipEmptyFields yes/no/y/n
useHeader yes/no/y/n
xyDms yes/no/y/n
trimFields yes/no/y/n
encoding <encode> e.g. utf-8, turkish, latin1
subset ???
detectType yes/no/y/n
decimalPoint <decimal character is comma> -> ,
booleanTrue <text for True> e.g. true, True, TRUE, OK etc.
booleanFalse <text for False> e.g. false, False, FALSE etc.

Uri structure:

uri = f"file://{file_path}?key=value&key=value&..."

References:

2
  • 2
    What is your reference?
    – Noura
    Mar 24 at 11:07
  • 1
    Actually I just reviewed the source files. Mar 24 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.