Public Member Functions | |
LSDSpatialCSVReader (string csv_fname) | |
Create an LSDSpatialCSVReader from a raster and csv filenname. More... | |
LSDSpatialCSVReader (LSDRaster &ThisRaster, string csv_fname) | |
Create an LSDSpatialCSVReader from a raster and csv filenname. More... | |
LSDSpatialCSVReader (LSDRasterInfo &ThisRaster, string csv_fname) | |
Create an LSDSpatialCSVReader from a raster. More... | |
LSDSpatialCSVReader (int nrows, int ncols, float xmin, float ymin, float cellsize, float ndv, map< string, string > temp_GRS, vector< double > &this_latitude, vector< double > &this_longitude, vector< bool > &this_is_point_in_raster, map< string, vector< string > > &this_data_map) | |
Create an LSDSpatialCSVReader from all the data elements. More... | |
void | load_csv_data (string filename) |
This loads a csv file, grabbing the latitude and longitude, and putting the rest of the data into data maps. More... | |
bool | check_if_latitude_and_longitude_exist () |
This tests to see if there are latitude and longitude vectors. More... | |
bool | check_if_all_data_columns_same_length () |
This tests to see if all the data columns are the same length as the latitude and longitude data columns. More... | |
void | set_UTM_information (int UTM_zone, bool is_North) |
this function sets a UTM_ coordinate system string the map is in the northern hemisphere More... | |
void | get_UTM_information (int &UTM_zone, bool &is_North) |
this function gets the UTM_zone and a boolean that is true if the map is in the northern hemisphere More... | |
void | get_x_and_y_from_latlong (vector< float > &UTME, vector< float > &UTMN) |
This takes latitude and longitude (in WGS 84) and converts to vectors of easting and northing in UTM. More... | |
void | get_x_and_y_from_latlong_specify_columns (string lat_column_name, string long_column_name, vector< float > &UTME, vector< float > &UTMN) |
This takes latitude and longitude (in WGS 84) and converts to vectors of easting and northing in UTM. User must specify the column for lat and long (this can be used for csv files where the column is not headed simply "latitude" or "longitude". More... | |
void | get_latlong_from_x_and_y (string X_column_name, string Y_column_name) |
This takes the X and Y columns in a csv, assumes they are UTM, and converts to latitude and loingitude in WGS84. More... | |
void | burn_raster_data_to_csv (LSDRaster &ThisRaster, string column_name) |
Takes raster data and adds it to the data column. More... | |
void | burn_raster_data_to_csv (LSDIndexRaster &ThisRaster, string column_name) |
Takes raster data and adds it to the data column. More... | |
void | get_data_in_raster_for_snapping (string column_name, vector< float > &UTMEasting, vector< float > &UTMNorthing, vector< string > &data_vector) |
This gets UTM coordinates and a data vector (usually IDs) for snapping to a channel network. More... | |
vector< string > | get_data_column (string column_name) |
This gets a data column from the csv file. More... | |
vector< float > | data_column_to_float (string column_name) |
This gets a data column from the csv file, and converts it to a float vector. More... | |
vector< int > | data_column_to_int (string column_name) |
This gets a data column from the csv file, and converts it to an int vector. More... | |
void | check_if_points_are_in_raster () |
this check to see if a point is within the raster More... | |
void | get_nodeindices_from_x_and_y_coords (LSDFlowInfo &FlowInfo, vector< float > &X_coords, vector< float > &Y_coords, vector< int > &NodeIndices) |
This function gets vectors of x and y coordinates and node indices from these points. More... | |
LSDSpatialCSVReader | select_data_to_new_csv_object (string selection_column, vector< string > data_for_selection) |
This selects specified data and crease a new csv object with just that data. More... | |
void | print_data_map_keys_to_screen () |
this prints keys of the data map to screen More... | |
void | print_lat_long_to_screen () |
this prints the latitude and longitude to screen More... | |
void | print_lat_long_to_screen (bool only_print_in_raster) |
this prints the latitude and longitude to screen More... | |
void | print_UTM_coords_to_csv (vector< float > UTME, vector< float > UTMN, string csv_outname) |
print the UTM coords to a csv file for checking More... | |
void | print_data_to_csv (string csv_outname) |
print the data to a csv. Used after updating data More... | |
void | print_data_to_geojson (string json_outname) |
print the data to a geojson. Used after updating data More... | |
vector< double > | get_latitude () const |
Gets the various data members. | |
vector< double > | get_longitude () const |
Protected Attributes | |
int | NRows |
Number of rows. | |
int | NCols |
Number of columns. | |
float | XMinimum |
Minimum X coordinate. | |
float | YMinimum |
Minimum Y coordinate. | |
float | DataResolution |
Data resolution. | |
int | NoDataValue |
No data value. | |
map< string, string > | GeoReferencingStrings |
A map of strings for holding georeferencing information. | |
vector< double > | latitude |
A vector of the latitude (in WGS84) | |
vector< double > | longitude |
A vector of the longitude (in WGS84) | |
vector< bool > | is_point_in_raster |
A vector of bools telling if the points are in the raster. | |
map< string, vector< string > > | data_map |
The map. | |
|
inline |
Create an LSDSpatialCSVReader from a raster and csv filenname.
csv_fname | The name of the csv file including extension and path |
|
inline |
Create an LSDSpatialCSVReader from a raster and csv filenname.
ThisRaster | An LSDRaster object |
csv_fname | The name of the csv file including extension and path |
|
inline |
Create an LSDSpatialCSVReader from a raster.
ThisRaster | An LSDIndexRaster object |
csv_fname | The name of the csv file including extension and path |
|
inline |
Create an LSDSpatialCSVReader from all the data elements.
nrows | An integer of the number of rows. |
ncols | An integer of the number of columns. |
xmin | A float of the minimum X coordinate. |
ymin | A float of the minimum Y coordinate. |
cellsize | A float of the cellsize. |
ndv | An integer of the no data value. |
data | An Array2D of floats in the shape nrows*ncols, |
temp_GRS | a map of strings containing georeferencing information. Used mainly with ENVI format files |
this_latitude | the latitudes in WGS84 |
this_longitude | the longitudes in WGS84 |
this_is_point_in_raster | bool vec for testing if point in raster domain |
this_data_map | the data elements |
void LSDSpatialCSVReader::burn_raster_data_to_csv | ( | LSDRaster & | ThisRaster, |
string | column_name | ||
) |
void LSDSpatialCSVReader::burn_raster_data_to_csv | ( | LSDIndexRaster & | ThisRaster, |
string | column_name | ||
) |
Takes raster data and adds it to the data column.
TheRaster | an LSDIndexRaster |
bool LSDSpatialCSVReader::check_if_all_data_columns_same_length | ( | ) |
This tests to see if all the data columns are the same length as the latitude and longitude data columns.
bool LSDSpatialCSVReader::check_if_latitude_and_longitude_exist | ( | ) |
This tests to see if there are latitude and longitude vectors.
void LSDSpatialCSVReader::check_if_points_are_in_raster | ( | ) |
this check to see if a point is within the raster
X_coordinate | the x location of the point |
Y_coordinate | the y location of the point |
vector< float > LSDSpatialCSVReader::data_column_to_float | ( | string | column_name | ) |
This gets a data column from the csv file, and converts it to a float vector.
column_name | a string that holds the column name |
vector< int > LSDSpatialCSVReader::data_column_to_int | ( | string | column_name | ) |
This gets a data column from the csv file, and converts it to an int vector.
column_name | a string that holds the column name |
vector< string > LSDSpatialCSVReader::get_data_column | ( | string | column_name | ) |
This gets a data column from the csv file.
column_name | a string that holds the column name |
void LSDSpatialCSVReader::get_data_in_raster_for_snapping | ( | string | column_name, |
vector< float > & | UTMEasting, | ||
vector< float > & | UTMNorthing, | ||
vector< string > & | data_vector | ||
) |
This gets UTM coordinates and a data vector (usually IDs) for snapping to a channel network.
column_name | a string that holds the column name |
UTMEasting | The easting coordinate (is overwritten) |
UTMNorthing | The northing coordinate (is overwritten) |
data_vector | the data in a strong vector from the column. Usually sample ID for snapping |
void LSDSpatialCSVReader::get_latlong_from_x_and_y | ( | string | X_column_name, |
string | Y_column_name | ||
) |
This takes the X and Y columns in a csv, assumes they are UTM, and converts to latitude and loingitude in WGS84.
X_column_name | Name of the column in the csv with X coordinate (easting) |
Y_column_name | Name of the column in the csv with Y coordinate (northing) |
void LSDSpatialCSVReader::get_nodeindices_from_x_and_y_coords | ( | LSDFlowInfo & | FlowInfo, |
vector< float > & | X_coords, | ||
vector< float > & | Y_coords, | ||
vector< int > & | NodeIndices | ||
) |
This function gets vectors of x and y coordinates and node indices from these points.
This DOES NOT use latitude and longitude, instead it assumes that your csv file has columns labelled "X" and "Y". Can be used when you want to read in points without converting from latitude and longitude.
FlowInfo | LSDFLowInfo object |
X_coords | vector to write X coords to |
Y_coords | vector to write Y coords to |
NodeIndices | vector to write node indices |
void LSDSpatialCSVReader::get_UTM_information | ( | int & | UTM_zone, |
bool & | is_North | ||
) |
this function gets the UTM_zone and a boolean that is true if the map is in the northern hemisphere
UTM_zone | the UTM zone. Replaced in function. |
is_North | a boolean that is true if the DEM is in the northern hemisphere. replaced in function |
void LSDSpatialCSVReader::get_x_and_y_from_latlong | ( | vector< float > & | UTME, |
vector< float > & | UTMN | ||
) |
This takes latitude and longitude (in WGS 84) and converts to vectors of easting and northing in UTM.
UTME | The easting coordinate (is overwritten) |
UTMN | The northing coordinate (is overwritten) |
void LSDSpatialCSVReader::get_x_and_y_from_latlong_specify_columns | ( | string | lat_column_name, |
string | long_column_name, | ||
vector< float > & | UTME, | ||
vector< float > & | UTMN | ||
) |
This takes latitude and longitude (in WGS 84) and converts to vectors of easting and northing in UTM. User must specify the column for lat and long (this can be used for csv files where the column is not headed simply "latitude" or "longitude".
lat_column_name | The header of the latitude column (string) |
long_column_name | The header of the longitude column (string) |
UTME | The easting coordinate (is overwritten) |
UTMN | The northing coordinate (is overwritten) |
void LSDSpatialCSVReader::load_csv_data | ( | string | filename | ) |
This loads a csv file, grabbing the latitude and longitude, and putting the rest of the data into data maps.
filename | The name of the csv file including path and extension |
void LSDSpatialCSVReader::print_data_map_keys_to_screen | ( | ) |
this prints keys of the data map to screen
void LSDSpatialCSVReader::print_data_to_csv | ( | string | csv_outname | ) |
print the data to a csv. Used after updating data
csv_outname | the name of the new file |
void LSDSpatialCSVReader::print_data_to_geojson | ( | string | json_outname | ) |
print the data to a geojson. Used after updating data
json_outname | the name of the new file |
void LSDSpatialCSVReader::print_lat_long_to_screen | ( | ) |
this prints the latitude and longitude to screen
void LSDSpatialCSVReader::print_lat_long_to_screen | ( | bool | only_print_in_raster | ) |
this prints the latitude and longitude to screen
only_print_in_raster | a bool when true only prints points in raster |
void LSDSpatialCSVReader::print_UTM_coords_to_csv | ( | vector< float > | UTME, |
vector< float > | UTMN, | ||
string | csv_outname | ||
) |
print the UTM coords to a csv file for checking
UTME | eastings |
UTMN | northings |
LSDSpatialCSVReader LSDSpatialCSVReader::select_data_to_new_csv_object | ( | string | selection_column, |
vector< string > | data_for_selection | ||
) |
This selects specified data and crease a new csv object with just that data.
selection_column | The name of the column from which the data will be selected |
data_for_selection | a vector holding the values of the data column that will be selected. Rows without these values will be removed |
void LSDSpatialCSVReader::set_UTM_information | ( | int | UTM_zone, |
bool | is_North | ||
) |
this function sets a UTM_ coordinate system string the map is in the northern hemisphere
UTM_zone | the UTM zone. Replaced in function. |
is_North | a boolean that is true if the DEM is in the northern hemisphere. replaced in function |