v.in.csv
Import a CSV file using pyproj for CRS transformation
v.in.csv input=name output=name separator=character latitude=string longitude=string crs=string [limit=integer] [int_columns=string [,string,...]] [real_columns=string [,string,...]] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
v.in.csv input=name output=name separator=comma latitude=string longitude=string crs=EPSG:4326
grass.script.run_command("v.in.csv", input, output, separator="comma", latitude, longitude, crs="EPSG:4326", limit=None, int_columns=None, real_columns=None, overwrite=False, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("v.in.csv", input="name", output="name", separator="comma", latitude="string", longitude="string", crs="EPSG:4326")
Parameters
input=name [required]
Name of input file
output=name [required]
Name for output vector map
separator=character [required]
Field separator
Special characters: pipe, comma, space, tab, newline
Default: comma
latitude=string [required]
Name of column used as latitude
longitude=string [required]
Name of column used as longitude
crs=string [required]
Coordinate reference system (CRS) of the coordinates
EPSG code (e.g. 4326 or EPSG:4326), WKT string, and PROJ string are recognized
Default: EPSG:4326
limit=integer
Limit number of lines processed
Allowed values: 1-
int_columns=string [,string,...]
Names of columns which are integers
real_columns=string [,string,...]
Names of columns which are double floating point numbers (floats)
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
input : str, required
Name of input file
Used as: input, file, name
output : str, required
Name for output vector map
Used as: output, vector, name
separator : str, required
Field separator
Special characters: pipe, comma, space, tab, newline
Used as: input, separator, character
Default: comma
latitude : str, required
Name of column used as latitude
longitude : str, required
Name of column used as longitude
crs : str, required
Coordinate reference system (CRS) of the coordinates
EPSG code (e.g. 4326 or EPSG:4326), WKT string, and PROJ string are recognized
Default: EPSG:4326
limit : int, optional
Limit number of lines processed
Allowed values: 1-
int_columns : str | list[str], optional
Names of columns which are integers
real_columns : str | list[str], optional
Names of columns which are double floating point numbers (floats)
overwrite: bool, optional
Allow output files to overwrite existing files
Default: False
verbose: bool, optional
Verbose module output
Default: False
quiet: bool, optional
Quiet module output
Default: False
superquiet: bool, optional
Very quiet module output
Default: False
DESCRIPTION
v.in.csv imports rows from a CSV (Comma Separated Value) file into a
vector map as points with attributes. The separator for CSV is comma
(,
) by default, but it can be set to any single character such as
semicolon (;
), pipe (|
), or tabulator.
NOTES
The module requires the "pyproj" Python package to work.
EXAMPLES
The following imports CSV file called latest_sites.csv
in the current
directory into the current mapset as point vector map named
sampling_sites
using the default coordinate transformation from WGS84.
Latitude and longitude are in columns Site_Lat
and Site_Long
.
v.in.csv input=latest_sites.csv output=sampling_sites latitude=Site_Lat longitude=Site_Long
SEE ALSO
- v.in.ascii for the underlying module with finer control (but not coordinate transformation),
- v.in.ogr for an alternative CSV import using GDAL/OGR.
AUTHOR
Vaclav Petras, NCSU Center for Geospatial Analytics
SOURCE CODE
Available at: v.in.csv source code
(history)
Latest change: Friday Feb 21 10:10:05 2025 in commit 7d78fe3