Closed ajay1606 closed 3 years ago
as already disussed in #183, everything in lanelet2 is in a metric coordinates. Our examples should cover how to get the local x/y coordinates of points within a lanelet.
If you want lat/lon coordinates, you have to transform these points into GPSPoints
using the projection. That is covered in the examples too.
@poggenhans Thanks so much for your response. Here, the problem is not about the local_x/local_y or lat/long. Instead am trying to retrieve position information (local_x/local_y, lat/long) in the laneletLayer. Here with Step by Step code and my question regarding the position retriving!
//Get nearest lanelet
std::vector<std::pair<double, lanelet::Lanelet>> nearest_lanelets = lanelet::geometry::findNearest(lanelet_map_ptr_->laneletLayer, search_point, 4);
//Iterating each lanelet in nearest_lanelet and get attributes associated with each lanelet.
for (const auto & lanelet : nearest_lanelets)
Each lanelet contains following :
Using lanelet.second.leftBound()
able to get following id:
Lanelet Left :[id: 189972683 point ids: 189968497, 189972685, 189972686, 189972687, 189972688, 189972689, 189972690, 189972691, 189969770]
Lanelet Right :[id: 189972693 point ids: 189968503, 189972695, 189972696, 189972697, 189972698, 189972699, 189972700, 189972701, 189972702, 189969774]
So my question is here, How to get position data associated with the point ids. Is there any function or code, where i can access this point ids to get position ?
For example: Accessing id of lanelet leftbound string could be done like this ;
Lanelet Left :[id: 189972683 point ids: 189968497, 189972685, 189972686, 189972687, 189972688, 189972689, 189972690, 189972691, 189969770]
lanelet.leftBound().id()
returns 189972683
lanelet.leftBound().id().front() returns 189968497 (first node of the line string)
SO my question here is, How can i access to other Point Id's returned bylanelet.leftBound()
and how i can get access to position data associated with each of the Points ids.
Your help much appreciated.
Kind Regards, AJay
Hello, As i understand, Points are composed of ID, 3D coordinates and attributes, and are the only elements that store actual position information. The ID must be unique. The other basic elements are directly or indirectly composed of points.
Am trying to fetch information stored in Points Datastructure Lanelet using the following function; Using
lanelet_map_ptr_->laneletLayer.search(lanelet::BoundingBox2d(search_point, search_point2));
am able to get point ids as like belowFurther, how can I get lat&lon information stored in the points with ids? Could anyone please suggest.
Regards, Ajay