|
sgsPy
structurally guided sampling
|
#include <vector.h>
Public Member Functions | |
| GDALVectorWrapper (std::string filename, std::string projDBPath) | |
| GDALVectorWrapper (GDALDataset *p_dataset, std::string projection) | |
| GDALVectorWrapper (std::string bytes, std::string projection, std::string name, std::string projDBPath) | |
| GDALDataset * | getDataset () |
| std::vector< std::string > | getLayerNames () |
| std::unordered_map< std::string, std::string > | getLayerInfo (std::string layerName) |
| OGRLayer * | getLayer (std::string layerName) |
| std::vector< std::vector< double > > | getPoints (std::string layerName) |
| std::vector< std::string > | getPointsAsWkt (std::string layerName) |
| std::vector< std::vector< std::vector< double > > > | getLineStrings (std::string layerName) |
| void | write (std::string filename) |
| std::string | getFullProjectionInfo () |
| OGRSpatialReference * | getSRS (void) |
Wrapper class for GDAL dataset containing a vector image.
This class provides getter methods for important vector data and metadata, as well as access to individual layers as OGRLayer * pointers.
The Python side of the application only has access to metadata on each layer.
The C++ side of the application has access to the getLayer() function.
|
inline |
Constructor for GDALVectorWrapper class. this method registers drivers, and creates a GDALDataset object. Set the search path for the proj.db file, because this function may be the first called from the Python side of the application, meaning this instance of GDAL may not have found a proj.db file
| std::string | filename |
| std::string | projDBPath |
|
inline |
Constructor for GDALVectorWrapper class.
| GDALDataset | * |
| std::string | projection |
|
inline |
Constructor for GDALVectorWrapper class. This constructor is meant to be used when importing data from another Python geospatial library, like geopandas. The geodataset is converted to a geojson string and passed to the GDALOpenEx() function to create a GDALDataset. This dataset unfortunately won't have the correcct layer name, and may have an incorrect spatial reference system. Because of this, a GDALDataset is created with a new OGRLayer containing the correct layer name and spatial reference system. The geometries with their fields are then copied from the geojson-created dataset to the new initialized dataset. Set the search path for the proj.db file, because this function may be the first called from the Python side of the application, meaning this instance of GDAL may not have found a proj.db file yet.
| std::vector<std::string> | geometries |
| std::string | projection |
| std::string | name |
| std::string | projDBPath |
|
inline |
Getter method for the dataset pointer.
|
inline |
Getter method for the full projection information as wkt.
|
inline |
Getter method for a particular layer.
| std::string | layerName |
|
inline |
Getter method for layer parameters. Including: feature count field count geometry type xmin xmax ymin ymax
| std::string | layer name |
|
inline |
Getter method for vector layer names.
|
inline |
Getter method for the layer Geometries. Note that every geometry within the layer must be of type LineString or MultiLineString.
The LineStrings are stored and returned as a 3d array of doubles. (std::vector<std::vector<std::vector<double>>>) Indexing the outer array gives the Line, which is a 2d array of points. The X coordinates are stored in index 0, Y in 1.
The array should be indexed like so: arr[line_index][0 if x or 1 if y][point_index]
For example, to get the x and y coordinates of the 2nd point in the 5th line: x = arr[4][0][1]; y = arr[4][1][1];
| std::string | layerName |
|
inline |
Getter method for the layer Geometries. Note that every geometry within the layer must be of type Point or MultiPoint.
The points are stored and returned as a 2d array of doubles (std::vector<std::vector<double>>) The X coordinates are stored in index 0, Y in 1.
The array should be indexed like so: arr[0 if x or 1 if y][point_index]
For example, to get the x and y coordinates of the 3rd point: x = arr[0][2]; y = arr[1][2]
| std::string | layerName |
|
inline |
Getter method for the layer geometries, where every geometry must be of type Point or MultiPoint.
the points are stored as wkt (well known text) strings in the return vector.
| std::string | layerName |
|
inline |
Getter method for OGRSpatialReference.
|
inline |
method for writing the existing dataset to a file.
This is intended to be used to write in-memory datasets generated by sampling methods to disk, however it should work for any dataset.
| std::string | filename |