CARLA
Loading...
Searching...
No Matches
OSM2ODR.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 <string>
10#include <vector>
11
12namespace osm2odr {
13
15 // Subtract the offset below from every projected coordinate.
16 bool use_offsets = false;
17 double offset_x = 0.0;
18 double offset_y = 0.0;
19
20 // Width of a driving lane, in metres. 0 keeps the converter's own table,
21 // which picks a width per highway type.
22 double default_lane_width = 0.0;
23
24 // Width of the sidewalk lane added to a way whose OSM tags declare one.
25 // 0 adds none.
27
28 // Height one OSM layer is raised by, so a bridge clears what it crosses.
30
31 // Projection written as the <geoReference> of the OpenDRIVE header. A
32 // +lat_0/+lon_0 in it also becomes the origin of the local projection.
33 std::string proj_string = "+proj=tmerc";
34
35 // Put the origin at the centre of the bounding box instead of its north
36 // west corner. CARLA's map generation expects the corner.
37 bool center_map = false;
38
39 // Emit a traffic light at junctions OSM tags highway=traffic_signals, or
40 // at every junction.
43
44 // OSM highway types to keep. Empty keeps the converter's own drivable set.
45 std::vector<std::string> osm_highways_types;
46
47 // Highway types that get no traffic light even when one is generated.
48 std::vector<std::string> tl_excluded_highways_types;
49 };
50
51 // Convert the contents of an OSM XML file to an OpenDRIVE description.
52 // Throws std::runtime_error when the input cannot be parsed.
53 std::string ConvertOSMToOpenDRIVE(
54 std::string osm_file,
55 OSM2ODRSettings settings = OSM2ODRSettings());
56
57} // namespace osm2odr
std::string ConvertOSMToOpenDRIVE(std::string osm_file, OSM2ODRSettings settings)
Definition OSM2ODR.cpp:55
std::string proj_string
Definition OSM2ODR.h:33
std::vector< std::string > osm_highways_types
Definition OSM2ODR.h:45
bool all_junctions_traffic_lights
Definition OSM2ODR.h:42
double elevation_layer_height
Definition OSM2ODR.h:29
double default_sidewalk_width
Definition OSM2ODR.h:26
std::vector< std::string > tl_excluded_highways_types
Definition OSM2ODR.h:48