23 return std::unexpected(
"Unsupported File Type");
24 switch (fileType.value()) {
28 if(std::filesystem::exists(path))
30 else return Shapefile(path.parent_path() /path.stem().replace_extension(
".shp"));
34 return std::unexpected(
"Unknown Error");
43 static std::vector<std::filesystem::path>
getGISFiles(
const std::filesystem::path & path){
44 std::vector<std::filesystem::path> gisFiles;
46 if(std::filesystem::is_symlink(path))
47 dir = std::filesystem::read_symlink(path);
48 if(not std::filesystem::is_directory(dir) && std::filesystem::is_regular_file(path) &&
getGISFileType(path).has_value()){
49 gisFiles.emplace_back(path);
52 for(
auto && file: std::filesystem::directory_iterator(dir)){
54 gisFiles.push_back(std::move(file));
static std::expected< Shapefile, std::string > convert(const GeoTiff &geoTiff, bool maskZero=true, bool showProgress=false) noexcept
Tries to convert a GeoTiff to Shp file.
Definition GISConverter.hpp:24
Definition GISFactory.hpp:12
static fishnet::Either< Shapefile, std::string > asShapefile(const std::filesystem::path &path)
Tries to construct ShapeFile handle from path. If path does not point to .shp file,...
Definition GISFactory.hpp:20
static std::vector< std::filesystem::path > getGISFiles(const std::filesystem::path &path)
Get all GIS files in a directory/ or a single file from a path.
Definition GISFactory.hpp:43
GeoTiff handle implementation.
Definition GeoTiff.hpp:8
Shapefile handle implementation.
Definition Shapefile.hpp:14
Definition BFSClustering.hpp:5
static fishnet::Option< GISFileType > getGISFileType(const std::filesystem::path &path)
Definition GISFile.hpp:18