CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
osm2odr
OsmIngest.h
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#pragma once
8
9
#include <map>
10
#include <optional>
11
#include <string>
12
#include <vector>
13
14
#include "
Model.h
"
15
16
namespace
twinmodel
{
17
18
struct
OsmNode
{
19
long
long
id
= 0;
20
double
lat
= 0.0;
21
double
lon
= 0.0;
22
Tags
tags
;
23
};
24
25
struct
OsmWay
{
26
long
long
id
= 0;
27
std::vector<long long>
nodes
;
28
Tags
tags
;
29
};
30
31
struct
OsmMember
{
32
std::string
type
;
33
long
long
ref
= 0;
34
std::string
role
;
35
};
36
37
struct
OsmRelation
{
38
long
long
id
= 0;
39
std::vector<OsmMember>
members
;
40
Tags
tags
;
41
};
42
43
struct
BoundingBox
{
44
double
south
= 0.0;
45
double
west
= 0.0;
46
double
north
= 0.0;
47
double
east
= 0.0;
48
};
49
50
struct
OsmData
{
51
std::map<long long, OsmNode>
nodes
;
52
std::vector<OsmWay>
ways
;
53
std::vector<OsmRelation>
relations
;
54
std::optional<BoundingBox>
bbox
;
55
56
/// Extent of the nodes themselves, used when the file carries no <bounds>
57
/// or the bounds are smaller than the ways crossing them.
58
BoundingBox
NodeExtent
()
const
;
59
};
60
61
/// Parse an OpenStreetMap XML document. Throws std::runtime_error when the
62
/// document cannot be parsed or carries no nodes.
63
OsmData
ParseOsmXml
(
const
std::string &xml);
64
65
}
// namespace twinmodel
Model.h
twinmodel
Definition
Frame.cpp:12
twinmodel::ParseOsmXml
OsmData ParseOsmXml(const std::string &xml)
Parse an OpenStreetMap XML document.
Definition
OsmIngest.cpp:47
twinmodel::Tags
std::map< std::string, std::string > Tags
Definition
Model.h:18
twinmodel::BoundingBox
Definition
OsmIngest.h:43
twinmodel::BoundingBox::east
double east
Definition
OsmIngest.h:47
twinmodel::BoundingBox::west
double west
Definition
OsmIngest.h:45
twinmodel::BoundingBox::south
double south
Definition
OsmIngest.h:44
twinmodel::BoundingBox::north
double north
Definition
OsmIngest.h:46
twinmodel::OsmData
Definition
OsmIngest.h:50
twinmodel::OsmData::relations
std::vector< OsmRelation > relations
Definition
OsmIngest.h:53
twinmodel::OsmData::ways
std::vector< OsmWay > ways
Definition
OsmIngest.h:52
twinmodel::OsmData::NodeExtent
BoundingBox NodeExtent() const
Extent of the nodes themselves, used when the file carries no <bounds> or the bounds are smaller than...
Definition
OsmIngest.cpp:32
twinmodel::OsmData::nodes
std::map< long long, OsmNode > nodes
Definition
OsmIngest.h:51
twinmodel::OsmData::bbox
std::optional< BoundingBox > bbox
Definition
OsmIngest.h:54
twinmodel::OsmMember
Definition
OsmIngest.h:31
twinmodel::OsmMember::type
std::string type
Definition
OsmIngest.h:32
twinmodel::OsmMember::ref
long long ref
Definition
OsmIngest.h:33
twinmodel::OsmMember::role
std::string role
Definition
OsmIngest.h:34
twinmodel::OsmNode
Definition
OsmIngest.h:18
twinmodel::OsmNode::lat
double lat
Definition
OsmIngest.h:20
twinmodel::OsmNode::lon
double lon
Definition
OsmIngest.h:21
twinmodel::OsmNode::tags
Tags tags
Definition
OsmIngest.h:22
twinmodel::OsmRelation
Definition
OsmIngest.h:37
twinmodel::OsmRelation::members
std::vector< OsmMember > members
Definition
OsmIngest.h:39
twinmodel::OsmRelation::tags
Tags tags
Definition
OsmIngest.h:40
twinmodel::OsmWay
Definition
OsmIngest.h:25
twinmodel::OsmWay::nodes
std::vector< long long > nodes
Definition
OsmIngest.h:27
twinmodel::OsmWay::tags
Tags tags
Definition
OsmIngest.h:28
Generated by
1.18.0