1#ifndef OSMIUM_AREA_PROBLEM_REPORTER_OGR_HPP
2#define OSMIUM_AREA_PROBLEM_REPORTER_OGR_HPP
77 feature.set_field(
"obj_type", t);
78 feature.set_field(
"obj_id",
static_cast<int32_t
>(
m_object_id));
79 feature.set_field(
"nodes",
static_cast<int32_t
>(
m_nodes));
85 feature.set_field(
"id1",
static_cast<double>(id1));
86 feature.set_field(
"id2",
static_cast<double>(id2));
87 feature.set_field(
"problem", problem_type);
88 feature.add_to_layer();
92 auto ogr_linestring = std::unique_ptr<OGRLineString>{
new OGRLineString{}};
93 ogr_linestring->addPoint(loc1.
lon(), loc1.
lat());
94 ogr_linestring->addPoint(loc2.
lon(), loc2.
lat());
96 gdalcpp::Feature feature{
m_layer_lerror, std::move(ogr_linestring)};
98 feature.set_field(
"id1",
static_cast<double>(id1));
99 feature.set_field(
"id2",
static_cast<double>(id2));
100 feature.set_field(
"problem", problem_type);
101 feature.add_to_layer();
115 .add_field(
"obj_type", OFTString, 1)
116 .add_field(
"obj_id", OFTInteger, 10)
117 .add_field(
"nodes", OFTInteger, 8)
118 .add_field(
"id1", OFTReal, 12, 1)
119 .add_field(
"id2", OFTReal, 12, 1)
120 .add_field(
"problem", OFTString, 30);
123 .add_field(
"obj_type", OFTString, 1)
124 .add_field(
"obj_id", OFTInteger, 10)
125 .add_field(
"nodes", OFTInteger, 8)
126 .add_field(
"id1", OFTReal, 12, 1)
127 .add_field(
"id2", OFTReal, 12, 1)
128 .add_field(
"problem", OFTString, 30);
131 .add_field(
"obj_type", OFTString, 1)
132 .add_field(
"obj_id", OFTInteger, 10)
133 .add_field(
"way_id", OFTInteger, 10)
134 .add_field(
"nodes", OFTInteger, 8);
138 write_point(
"duplicate_node", node_id1, node_id2, location);
142 write_point(
"touching_ring", node_id, 0, location);
147 write_point(
"intersection", way1_id, way2_id, intersection);
148 write_line(
"intersection", way1_id, way2_id, way1_seg_start, way1_seg_end);
149 write_line(
"intersection", way2_id, way1_id, way2_seg_start, way2_seg_end);
165 write_line(
"role_should_be_outer", way_id, 0, seg_start, seg_end);
169 write_line(
"role_should_be_inner", way_id, 0, seg_start, seg_end);
173 if (way.nodes().size() < 2) {
179 feature.set_field(
"id1",
static_cast<int32_t
>(way.id()));
180 feature.set_field(
"id2", 0);
181 feature.set_field(
"problem",
"way_in_multiple_rings");
182 feature.add_to_layer();
189 if (way.nodes().size() < 2) {
195 feature.set_field(
"id1",
static_cast<int32_t
>(way.id()));
196 feature.set_field(
"id2", 0);
197 feature.set_field(
"problem",
"inner_with_same_tags");
198 feature.add_to_layer();
205 if (way.nodes().size() < 2) {
211 feature.set_field(
"id1",
static_cast<int32_t
>(way.id()));
212 feature.set_field(
"id2", 0);
213 feature.set_field(
"problem",
"duplicate_way");
214 feature.add_to_layer();
221 if (way.nodes().empty()) {
224 if (way.nodes().size() == 1) {
225 const auto& first_nr = way.nodes()[0];
226 write_point(
"single_node_in_way", way.id(), first_nr.ref(), first_nr.location());
232 feature.set_field(
"way_id",
static_cast<int32_t
>(way.id()));
233 feature.add_to_layer();
Definition: location.hpp:271
double lon() const
Definition: location.hpp:400
double lat() const
Definition: location.hpp:419
Definition: node_ref.hpp:50
constexpr osmium::object_id_type ref() const noexcept
Definition: node_ref.hpp:71
osmium::Location & location() noexcept
Definition: node_ref.hpp:85
Definition: problem_reporter_ogr.hpp:67
void report_ring_not_closed(const osmium::NodeRef &nr, const osmium::Way *way) override
Definition: problem_reporter_ogr.hpp:160
void report_duplicate_segment(const osmium::NodeRef &nr1, const osmium::NodeRef &nr2) override
Definition: problem_reporter_ogr.hpp:152
osmium::geom::OGRFactory m_ogr_factory
Definition: problem_reporter_ogr.hpp:69
void report_inner_with_same_tags(const osmium::Way &way) override
Definition: problem_reporter_ogr.hpp:188
gdalcpp::Layer m_layer_ways
Definition: problem_reporter_ogr.hpp:73
void report_overlapping_segment(const osmium::NodeRef &nr1, const osmium::NodeRef &nr2) override
Definition: problem_reporter_ogr.hpp:156
void report_role_should_be_outer(osmium::object_id_type way_id, osmium::Location seg_start, osmium::Location seg_end) override
Definition: problem_reporter_ogr.hpp:164
void write_point(const char *problem_type, osmium::object_id_type id1, osmium::object_id_type id2, osmium::Location location)
Definition: problem_reporter_ogr.hpp:82
gdalcpp::Layer m_layer_lerror
Definition: problem_reporter_ogr.hpp:72
void report_duplicate_way(const osmium::Way &way) override
Definition: problem_reporter_ogr.hpp:204
ProblemReporterOGR(gdalcpp::Dataset &dataset)
Definition: problem_reporter_ogr.hpp:106
void report_way_in_multiple_rings(const osmium::Way &way) override
Definition: problem_reporter_ogr.hpp:172
void write_line(const char *problem_type, osmium::object_id_type id1, osmium::object_id_type id2, osmium::Location loc1, osmium::Location loc2)
Definition: problem_reporter_ogr.hpp:91
void report_touching_ring(osmium::object_id_type node_id, osmium::Location location) override
Definition: problem_reporter_ogr.hpp:141
gdalcpp::Layer m_layer_perror
Definition: problem_reporter_ogr.hpp:71
void report_way(const osmium::Way &way) override
Definition: problem_reporter_ogr.hpp:220
void report_role_should_be_inner(osmium::object_id_type way_id, osmium::Location seg_start, osmium::Location seg_end) override
Definition: problem_reporter_ogr.hpp:168
void set_object(gdalcpp::Feature &feature)
Definition: problem_reporter_ogr.hpp:75
void report_intersection(osmium::object_id_type way1_id, osmium::Location way1_seg_start, osmium::Location way1_seg_end, osmium::object_id_type way2_id, osmium::Location way2_seg_start, osmium::Location way2_seg_end, osmium::Location intersection) override
Definition: problem_reporter_ogr.hpp:145
void report_duplicate_node(osmium::object_id_type node_id1, osmium::object_id_type node_id2, osmium::Location location) override
Definition: problem_reporter_ogr.hpp:137
Definition: problem_reporter.hpp:60
osmium::object_id_type m_object_id
Definition: problem_reporter.hpp:68
osmium::item_type m_object_type
Definition: problem_reporter.hpp:65
size_t m_nodes
Definition: problem_reporter.hpp:71
Definition: factory.hpp:149
point_type create_point(const osmium::Location &location) const
Definition: factory.hpp:211
linestring_type create_linestring(const osmium::WayNodeList &wnl, use_nodes un=use_nodes::unique, direction dir=direction::forward)
Definition: factory.hpp:266
Definition: factory.hpp:60
@ area
Definition: entity_bits.hpp:72
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
int64_t object_id_type
Type for OSM object (node, way, or relation) IDs.
Definition: types.hpp:45
char item_type_to_char(const item_type type) noexcept
Definition: item_type.hpp:122