Convert csv to geodataframe
csv_to_geodataframe(csv, indexes, target_crs)
Read CSV file to a GeoDataFrame.
Usage of single index expects valid WKT geometry. Usage of two indexes expects POINT feature(s) X-coordinate as the first index and Y-coordinate as the second index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
csv |
Path
|
Path to the .csv file to be read. |
required |
indexes |
Sequence[int]
|
Index(es) of the geometry column(s). |
required |
target_crs |
int
|
Target CRS as an EPSG code. |
required |
Returns:
Type | Description |
---|---|
GeoDataFrame
|
CSV file read to a GeoDataFrame. |
Raises:
Type | Description |
---|---|
InvalidColumnIndexException
|
There is a mismatch between the provided indexes and the shape of the dataframe read from the csv. |
InvalidParameterValueException
|
Unable to create a GeoDataFrame with point features from the given input parameters. |
InvalidWktFormatException
|
Unable to create a GeoDataFrame of WKT geometry from the given input parameters. |
Source code in eis_toolkit/conversions/csv_to_geodataframe.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|