boat
C++23 geospatial library
Loading...
Searching...
No Matches
meta.hpp
Go to the documentation of this file.
1
// Andrew Naplavkov
2
3
#ifndef BOAT_DB_META_HPP
4
#define BOAT_DB_META_HPP
5
6
#include <
boat/geometry/vocabulary.hpp
>
7
#include <cstdint>
8
#include <string>
9
#include <vector>
10
11
namespace
boat::db
{
12
13
struct
source
{
14
std::string
source_name
;
15
std::string
address
;
16
};
17
18
struct
layer
{
19
std::string
schema_name
;
20
std::string
table_name
;
21
std::string
column_name
;
22
bool
raster
;
23
24
friend
bool
operator==
(
layer
const
&,
layer
const
&) =
default
;
25
};
26
27
struct
column
{
28
std::string
kind
;
29
std::string
column_name
;
30
std::string
type_name
;
31
int
length
;
32
int
srid
;
33
int
epsg
;
34
std::string
wkt
;
35
std::string
proj4
;
36
};
37
38
inline
bool
has_coord_sys
(
column
const
& col)
39
{
40
return
col.
epsg
> 0 || !col.
wkt
.empty() || !col.
proj4
.empty();
41
}
42
43
struct
index_key
{
44
std::string
schema_name
;
45
std::string
index_name
;
46
std::string
column_name
;
47
bool
descending
;
48
bool
partial
;
49
bool
primary
;
50
bool
unique
;
51
int
ordinal
;
52
};
53
54
struct
table
{
55
std::string
dbms
;
56
std::string
schema_name
;
57
std::string
table_name
;
58
std::vector<column>
columns
;
59
std::vector<index_key>
index_keys
;
60
};
61
62
inline
auto
indices
(
table
const
& tbl)
63
{
64
return
tbl.
index_keys
| std::views::chunk_by([](
auto
& lhs,
auto
& rhs) {
65
return
lhs.ordinal < rhs.ordinal;
66
});
67
}
68
69
struct
bbox
{
70
std::vector<std::string>
select_list
;
71
std::string
layer_column
;
72
geometry::cartesian::box
bounds
;
//< Layer column's SRS.
73
int
limit
;
74
};
75
76
struct
order_key
{
77
std::string
column_name
;
78
bool
descending
;
79
};
80
81
struct
page
{
82
std::vector<std::string>
select_list
;
83
std::vector<order_key>
order_by
;
84
size_t
offset
;
85
int
limit
;
86
};
87
88
struct
band
{
89
std::string
color_name
;
90
std::string
type_name
;
91
};
92
93
struct
raster
{
94
std::string
schema_name
;
95
std::string
table_name
;
96
std::string
column_name
;
97
std::vector<band>
bands
;
98
geometry::raster::point
extent
;
99
double
xorig
;
100
double
yorig
;
101
double
xscale
;
102
double
yscale
;
103
double
xskew
;
104
double
yskew
;
105
int
srid
;
106
int
epsg
;
107
std::string
wkt
;
108
std::string
proj4
;
109
};
110
112
inline
geometry::matrix
affine
(
raster
const
& r)
113
{
114
return
{
115
{{r.
xscale
, r.
xskew
, r.
xorig
},
116
{r.
yskew
, r.
yscale
, r.
yorig
},
117
{0., 0., 1.}}};
118
}
119
120
}
// namespace boat::db
121
122
#endif
// BOAT_DB_META_HPP
boat::db
Definition
geometry.hpp:9
boat::db::affine
geometry::matrix affine(raster const &r)
Maps pixels to spatial coordinates.
Definition
meta.hpp:112
boat::db::has_coord_sys
bool has_coord_sys(column const &col)
Definition
meta.hpp:38
boat::db::indices
auto indices(table const &tbl)
Definition
meta.hpp:62
boat::geometry::matrix
boost::qvm::mat< double, 3, 3 > matrix
Definition
vocabulary.hpp:104
boat::db::band
Definition
meta.hpp:88
boat::db::band::color_name
std::string color_name
Lowercase.
Definition
meta.hpp:89
boat::db::band::type_name
std::string type_name
Lowercase.
Definition
meta.hpp:90
boat::db::bbox
Definition
meta.hpp:69
boat::db::bbox::bounds
geometry::cartesian::box bounds
Definition
meta.hpp:72
boat::db::bbox::limit
int limit
Definition
meta.hpp:73
boat::db::bbox::layer_column
std::string layer_column
Definition
meta.hpp:71
boat::db::bbox::select_list
std::vector< std::string > select_list
Definition
meta.hpp:70
boat::db::column
Definition
meta.hpp:27
boat::db::column::kind
std::string kind
Definition
meta.hpp:28
boat::db::column::proj4
std::string proj4
Definition
meta.hpp:35
boat::db::column::srid
int srid
Definition
meta.hpp:32
boat::db::column::wkt
std::string wkt
Definition
meta.hpp:34
boat::db::column::type_name
std::string type_name
Lowercase.
Definition
meta.hpp:30
boat::db::column::length
int length
Definition
meta.hpp:31
boat::db::column::column_name
std::string column_name
Definition
meta.hpp:29
boat::db::column::epsg
int epsg
Definition
meta.hpp:33
boat::db::index_key
Definition
meta.hpp:43
boat::db::index_key::ordinal
int ordinal
One-based.
Definition
meta.hpp:51
boat::db::index_key::partial
bool partial
Definition
meta.hpp:48
boat::db::index_key::primary
bool primary
Definition
meta.hpp:49
boat::db::index_key::column_name
std::string column_name
Definition
meta.hpp:46
boat::db::index_key::index_name
std::string index_name
Definition
meta.hpp:45
boat::db::index_key::descending
bool descending
Definition
meta.hpp:47
boat::db::index_key::schema_name
std::string schema_name
Definition
meta.hpp:44
boat::db::index_key::unique
bool unique
Definition
meta.hpp:50
boat::db::layer
Definition
meta.hpp:18
boat::db::layer::table_name
std::string table_name
Definition
meta.hpp:20
boat::db::layer::column_name
std::string column_name
Definition
meta.hpp:21
boat::db::layer::operator==
friend bool operator==(layer const &, layer const &)=default
boat::db::layer::schema_name
std::string schema_name
Definition
meta.hpp:19
boat::db::layer::raster
bool raster
Definition
meta.hpp:22
boat::db::order_key
Definition
meta.hpp:76
boat::db::order_key::column_name
std::string column_name
Definition
meta.hpp:77
boat::db::order_key::descending
bool descending
Definition
meta.hpp:78
boat::db::page
Definition
meta.hpp:81
boat::db::page::limit
int limit
Definition
meta.hpp:85
boat::db::page::order_by
std::vector< order_key > order_by
Definition
meta.hpp:83
boat::db::page::offset
size_t offset
Definition
meta.hpp:84
boat::db::page::select_list
std::vector< std::string > select_list
Definition
meta.hpp:82
boat::db::raster
Definition
meta.hpp:93
boat::db::raster::proj4
std::string proj4
Definition
meta.hpp:108
boat::db::raster::xorig
double xorig
Definition
meta.hpp:99
boat::db::raster::column_name
std::string column_name
Definition
meta.hpp:96
boat::db::raster::yskew
double yskew
Definition
meta.hpp:104
boat::db::raster::extent
geometry::raster::point extent
Definition
meta.hpp:98
boat::db::raster::bands
std::vector< band > bands
Definition
meta.hpp:97
boat::db::raster::table_name
std::string table_name
Definition
meta.hpp:95
boat::db::raster::xscale
double xscale
Definition
meta.hpp:101
boat::db::raster::yorig
double yorig
Definition
meta.hpp:100
boat::db::raster::epsg
int epsg
Definition
meta.hpp:106
boat::db::raster::srid
int srid
Definition
meta.hpp:105
boat::db::raster::wkt
std::string wkt
Definition
meta.hpp:107
boat::db::raster::yscale
double yscale
Definition
meta.hpp:102
boat::db::raster::schema_name
std::string schema_name
Definition
meta.hpp:94
boat::db::raster::xskew
double xskew
Definition
meta.hpp:103
boat::db::source
Definition
meta.hpp:13
boat::db::source::source_name
std::string source_name
Definition
meta.hpp:14
boat::db::source::address
std::string address
Definition
meta.hpp:15
boat::db::table
Definition
meta.hpp:54
boat::db::table::index_keys
std::vector< index_key > index_keys
Definition
meta.hpp:59
boat::db::table::table_name
std::string table_name
Definition
meta.hpp:57
boat::db::table::schema_name
std::string schema_name
Definition
meta.hpp:56
boat::db::table::columns
std::vector< column > columns
Definition
meta.hpp:58
boat::db::table::dbms
std::string dbms
Lowercase.
Definition
meta.hpp:55
boat::geometry::d2< double, cs::cartesian >::box
model::box< point > box
Definition
vocabulary.hpp:71
boat::geometry::d2< int, cs::cartesian >::point
model::d2::point_xy< int, cs::cartesian > point
Definition
vocabulary.hpp:65
vocabulary.hpp
include
boat
db
meta.hpp
Generated by
1.15.0