diff --git a/Docs/python_api.md b/Docs/python_api.md
index 8c3a60481..e7e0642b9 100644
--- a/Docs/python_api.md
+++ b/Docs/python_api.md
@@ -1025,6 +1025,11 @@ Returns the landmarks of a specific type. Landmarks retrieved using this method
- **Parameters:**
- `type` (_string_) – The type of the landmarks.
- **Return:** _list([carla.Landmark](#carla.Landmark))_
+- **get_landmark_group**(**self**, **landmark**)
+Returns the landmarks in the same group as the specified landmark (including itself). Returns an empty list if the landmark does not belong to any group.
+ - **Parameters:**
+ - `landmark` (_[carla.Landmark](#carla.Landmark)_) – A landmark that belongs to the group.
+ - **Return:** _list([carla.Landmark](#carla.Landmark))_
- **get_spawn_points**(**self**)
Returns a list of recommendations made by the creators of the map to be used as spawning points for the vehicles. The list includes [carla.Transform](#carla.Transform) objects with certain location and orientation. Said locations are slightly on-air in order to avoid Z-collisions, so vehicles fall for a bit before starting their way.
- **Return:** _list([carla.Transform](#carla.Transform))_
diff --git a/LibCarla/source/carla/client/Map.cpp b/LibCarla/source/carla/client/Map.cpp
index ca4554878..865016cbd 100644
--- a/LibCarla/source/carla/client/Map.cpp
+++ b/LibCarla/source/carla/client/Map.cpp
@@ -166,5 +166,20 @@ namespace client {
return result;
}
+ std::vector>
+ Map::GetLandmarkGroup(const Landmark &landmark) const {
+ std::vector> result;
+ auto &controllers = landmark._signal->GetSignal()->GetControllers();
+ for (auto& controller_id : controllers) {
+ const auto &controller = _map.GetControllers().at(controller_id);
+ for(auto& signal_id : controller->GetSignals()) {
+ auto& signal = _map.GetSignals().at(signal_id);
+ auto new_landmarks = GetLandmarksFromId(signal->GetSignalId());
+ result.insert(result.end(), new_landmarks.begin(), new_landmarks.end());
+ }
+ }
+ return result;
+ }
+
} // namespace client
} // namespace carla
diff --git a/LibCarla/source/carla/client/Map.h b/LibCarla/source/carla/client/Map.h
index 3ef40cf4e..f1c397088 100644
--- a/LibCarla/source/carla/client/Map.h
+++ b/LibCarla/source/carla/client/Map.h
@@ -91,6 +91,9 @@ namespace client {
/// Returns all the landmarks in the map of a specific type
std::vector> GetAllLandmarksOfType(std::string type) const;
+ /// Returns all the landmarks in the same group including this one
+ std::vector> GetLandmarkGroup(const Landmark &landmark) const;
+
private:
const rpc::MapInfo _description;
diff --git a/PythonAPI/carla/source/libcarla/Map.cpp b/PythonAPI/carla/source/libcarla/Map.cpp
index c39d8ed19..f07073a64 100644
--- a/PythonAPI/carla/source/libcarla/Map.cpp
+++ b/PythonAPI/carla/source/libcarla/Map.cpp
@@ -169,6 +169,7 @@ void export_map() {
.def("get_all_landmarks", CALL_RETURNING_LIST(cc::Map, GetAllLandmarks))
.def("get_all_landmarks_from_id", CALL_RETURNING_LIST_1(cc::Map, GetLandmarksFromId, std::string), (args("opendrive_id")))
.def("get_all_landmarks_of_type", CALL_RETURNING_LIST_1(cc::Map, GetAllLandmarksOfType, std::string), (args("type")))
+ .def("get_landmark_group", CALL_RETURNING_LIST_1(cc::Map, GetLandmarkGroup, cc::Landmark), args("landmark"))
.def(self_ns::str(self_ns::self))
;
diff --git a/PythonAPI/docs/map.yml b/PythonAPI/docs/map.yml
index 4751e254b..88cbaad0a 100644
--- a/PythonAPI/docs/map.yml
+++ b/PythonAPI/docs/map.yml
@@ -208,6 +208,16 @@
The type of the landmarks.
return: list(carla.Landmark)
# --------------------------------------
+ - def_name: get_landmark_group
+ doc: >
+ Returns the landmarks in the same group as the specified landmark (including itself). Returns an empty list if the landmark does not belong to any group.
+ params:
+ - param_name: landmark
+ type: carla.Landmark
+ doc: >
+ A landmark that belongs to the group.
+ return: list(carla.Landmark)
+ # --------------------------------------
- def_name: get_spawn_points
return: list(carla.Transform)
doc: >