DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

maps/docs/usecase3.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
2 
3 @page maps_usecase3 Map Query
4 
5 @note SW Release Applicability: This tutorial is applicable to modules in **NVIDIA DRIVE Software** releases.
6 
7 ## Result Buffers
8 
9 Maps module functions that return an array of elements write the returned elements into a fixed size buffer that is passed in as an argument. There are Buffer structs for various map elements:
10 
11 - `dwMapsGeoPointBuffer`
12 - `dwMapsPointBuffer`
13 - `dwMapsPolyline3fBuffer`
14 - `dwMapsLaneBuffer`
15 - `dwMapsLaneDividerLineBuffer`
16 - `dwMapsFeatureBuffer`
17 - `dwMapsLaneDividerBuffer`
18 - `dwMapsRoadSegmentBuffer`
19 - `dwMapsRoadSegmentPointerBuffer`
20 
21 A Buffer struct must be initialized before being passed to the function:
22 
23 - buffer: pointer to the fixed size array
24 - maxSize: size of the fixed size array
25 - size: current number of valid elements in the array
26 
27 ## Query Functions
28 
29 ### Road Segments
30 
31 Road Segments provide access to all the map data.
32 
33 The dwMaps_getRoadSegments() function returns copies of Road Segments that overlap with a bounding box of longitude and latitude coordinates.
34 
35 ```{.cpp}
36  dwStatus dwMaps_getRoadSegments(
37  dwMapsRoadSegmentBuffer* roadSegments,
38  const dwMapsBounds* bounds,
39  dwConstMapHandle_t mapHandle);
40 ```
41 
42 To retrieve pointers to Road Segments owned by the system instead use dwMaps_getRoadSegmentPointers().
43 This has the advantage of reduced memory footprint vs creating copies of dwMapsRoadSegment.
44 
45 ```{.cpp}
46  dwStatus dwMaps_getRoadSegmentPointers(
47  dwMapsRoadSegmentPointerBuffer* roadSegmentPointers,
48  const dwMapsBounds* bounds,
49  dwConstMapHandle_t mapHandle);
50 ```
51 
52 For convenience, there are a few more specific query functions:
53 
54 - `dwMaps_getLaneDividers()`
55 - `dwMaps_getFeatures()`
56 
57 ### Lane Dividers
58 
59 ```{.cpp}
60  dwStatus dwMaps_getLaneDividers(
61  dwMapsLaneDividerBuffer* laneDividers,
62  uint32_t typeFilter,
63  const dwMapsBounds* bounds,
64  dwConstMapHandle_t mapHandle);
65 ```
66 
67 `dwMaps_getLaneDividers()` returns all Lane Dividers that overlap with a bounding box of longitude and latitude coordinates, filtered by their type. A logical combination of type flags can be used to specify which Lane Dividers are returned.
68 
69 ### Features
70 
71 ```{.cpp}
72  dwStatus dwMaps_getFeatures(
73  dwMapsFeatureBuffer* features,
74  uint32_t typeFilter,
75  const dwMapsBounds* bounds,
76  dwConstMapHandle_t mapHandle);
77 ```
78 
79 `dwMaps_getFeatures()` works the same way as `dwMaps_getLaneDividers()`.
80 
81 ### Closest Lane
82 
83 ```{.cpp}
84  dwStatus dwMaps_getClosestLane(
85  const dwMapsLane** closestLane,
86  dwMapsGeoPoint* closestPoint,
87  const dwMapsGeoPoint* p,
88  dwBool onlyDrivable,
89  dwBool ignoreHeight,
90  dwConstMapHandle_t mapHandle);
91 ```
92 
93 `dwMaps_getClosestLane()` returns the closest Lane, and the closest point on it, to a given query point p. When the `onlyDrivable` flag is set to true, non-drivable lanes are not considered. `ignoreHeight` can be set if the height of the input point is unknown or inaccurate. In that case, the distances are compared, after projecting all points to height 0.
94 
95 @note The maps module also provides a map tracker that allows a robust selection of the current lane when driving along a road. It also incorporates orientation and logical connections and thus can give a better result than just picking the closest lane.
96 
97 For more information see @ref dwx_hd_map_access_sample .