boat
C++23 geospatial library
Loading...
Searching...
No Matches
commands.hpp
Go to the documentation of this file.
1// Andrew Naplavkov
2
3#ifndef BOAT_COMMANDS_HPP
4#define BOAT_COMMANDS_HPP
5
6#include <boat/db/command.hpp>
7#if __has_include(<gdal.h>)
10#endif
11#include <boat/sql/commands.hpp>
12
13namespace boat {
14
15inline std::unique_ptr<db::command> make_command(std::string_view address)
16{
17 if (sql::supported_url(address))
18 return sql::make_command(address);
19#if __has_include(<gdal.h>)
20 auto ret = std::make_unique<gdal::command>();
21 ret->dataset = gdal::open(std::string{address}.data());
22 return ret;
23#else
24 throw std::runtime_error("compiled without gdal");
25#endif
26}
27
28} // namespace boat
29
30#endif // BOAT_COMMANDS_HPP
dataset_ptr open(char const *file, bool update=false)
Definition dataset.hpp:11
std::unique_ptr< db::command > make_command(std::string_view url)
Throws if the URL scheme is unknown or its client library is unavailable.
Definition commands.hpp:32
bool supported_url(std::string_view url)
Recognizes SQL URL schemes even without the corresponding client library.
Definition url.hpp:11
Definition blob.hpp:11
std::unique_ptr< db::command > make_command(std::string_view address)
Definition commands.hpp:15