Unmanned vehicle trajectory rendering method and device, equipment and medium
Patent Information
- Application Number
- CN202610705710.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-20
- Publication Date
- 2026-08-18
AI Technical Summary
[0005]本申请实施例提供无人车轨迹渲染方法、装置、设备及介质,用以解决现有技术中存在资源占用高、依赖第三方数据库以及维护成本高的问题
[0070]The unmanned vehicle trajectory rendering method, apparatus, device, and medium provided in this application first acquire a continuous latitude and longitude coordinate sequence collected during the unmanned vehicle's operation, and converts the latitude and longitude coordinate sequence into a standardized geographic data format. By encapsulating discrete trajectory points using a unified data organization structure, the trajectory data gains standardized descriptive capabilities, facilitating subsequent coordinate analysis, trajectory calculation, and cross-system data interaction. Then, the bounding box of the trajectory is calculated based on the geographic data format, and a projection function mapping the latitude and longitude coordinates to two-dimensional planar coordinates is constructed based on the size parameters of the target vector canvas and the bounding box. This ensures that the trajectory maintains its original aspect ratio during scaling, avoiding trajectory distortion, and simultaneously achieving centered display of the trajectory on the canvas, improving performance. The system ensures the completeness and visualization of the trajectory display. Subsequently, it iterates through each latitude and longitude coordinate in the geographic data format and sequentially calls the projection function to calculate the screen coordinates of each coordinate on the target vector canvas. This involves converting spherical geographic coordinates into planar coordinates suitable for 2D graphics rendering, thereby achieving accurate positioning of the trajectory data in screen space and improving trajectory rendering accuracy and display consistency. Finally, it generates vector graphic path data based on each screen coordinate and embeds this data into the display interface to show the trajectory. Because it uses a vectorized trajectory description method, the trajectory edges remain clear and undistorted at different scaling ratios, while reducing graphic data redundancy and lowering system resource consumption. This achieves lightweight, high-performance visualization rendering of the autonomous vehicle trajectory.
Smart Images

Figure CN122597550A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of unmanned vehicle navigation and trajectory visualization, and in particular to an unmanned vehicle trajectory rendering method, device, equipment and medium. Background Technology
[0002] With the rapid development of unmanned vehicle (autonomous vehicles, logistics delivery robots, inspection robots, etc.) technology, the demand for high-precision trajectory visualization has exploded in many fields. For example, in logistics, unmanned vehicles need to display their transportation routes in real time to optimize route planning; in industrial inspection scenarios, unmanned vehicles record equipment inspection trajectories through high-precision Global Positioning System (GPS) and need to present the trajectory data to maintenance personnel in an intuitive way; in agricultural unmanned vehicle operations, trajectory visualization can help analyze the operation coverage area and efficiency. However, traditional map rendering technology faces significant challenges in these scenarios: the trajectory data collected by unmanned vehicles usually contains massive amounts of high-precision latitude and longitude coordinates (such as centimeter-level accuracy) and needs to be loaded, zoomed, and interacted with quickly on a web page. Therefore, there is an urgent need for a lightweight, high-performance trajectory rendering method to meet the real-time visualization requirements of high-precision trajectory data of unmanned vehicles on the web, while reducing system complexity and development barriers.
[0003] Existing technologies typically employ trajectory rendering solutions based on open-source map libraries. For example, they utilize front-end map frameworks such as Mapbox GLJS and Leaflet. This involves loading base map tiles, initializing a map container, converting GPS trajectory point data uploaded by the autonomous vehicle into standard geographic data formats like GeoJSON, and then calling the polyline drawing interface provided by the map library to connect multiple latitude and longitude coordinates in chronological order to form a trajectory path. Furthermore, to support features such as trajectory zooming, panning, and dynamic refresh, a rendering module, a coordinate projection transformation module, and an event interaction component are usually required to complete the trajectory visualization.
[0004] However, existing technologies suffer from high resource consumption, reliance on third-party databases, and high maintenance costs. Summary of the Invention
[0005] This application provides a method, apparatus, device, and medium for rendering unmanned vehicle trajectories, in order to solve the problems of high resource consumption, reliance on third-party databases, and high maintenance costs in the prior art.
[0006] In a first aspect, embodiments of this application provide a method for rendering the trajectory of an unmanned vehicle, including:
[0007] Acquire a continuous sequence of latitude and longitude coordinates collected by an unmanned vehicle, and convert the latitude and longitude coordinate sequence into a standardized geographic data format, wherein the geographic data format contains at least linear elements describing the geometry of the trajectory;
[0008] The bounding box of the trajectory is calculated based on the geographic data format, and a projection function that maps latitude and longitude coordinates to two-dimensional coordinates on a plane is constructed according to the size parameters of the target vector canvas and the bounding box.
[0009] Iterate through each of the latitude and longitude coordinates in the geographic data format, and sequentially call the projection function to calculate the screen coordinates of the latitude and longitude coordinates on the target vector canvas;
[0010] Vector graphic path data is generated based on each screen coordinate, and the vector graphic path data is embedded into the display interface to show the trajectory.
[0011] In one possible implementation, converting the latitude and longitude coordinate sequence into a standardized geographic data format includes:
[0012] The latitude and longitude coordinate sequence is organized into a line-type geometric object in GeoJSON format;
[0013] The geometric object is encapsulated as a collection of features containing geographic feature structures.
[0014] In one possible implementation, the step of calculating the bounding box of the trajectory based on the geographic data format, and constructing a projection function that maps latitude and longitude coordinates to planar two-dimensional coordinates according to the size parameters of the target vector canvas and the bounding box, includes:
[0015] Iterate through the latitude and longitude coordinates in the geographic data format and determine the minimum longitude value, maximum longitude value, minimum latitude value, and maximum latitude value among all latitude and longitude coordinates;
[0016] A bounding box is generated based on the minimum longitude value, maximum longitude value, minimum latitude value, and maximum latitude value to enclose the entire trajectory;
[0017] The actual drawing area is determined based on the width, height, and preset margin parameters of the target vector canvas. The actual drawing area includes the width and height of the actual drawing area.
[0018] Based on the actual drawing area and the bounding box, a projection function is constructed to map latitude and longitude coordinates to two-dimensional coordinates on a plane.
[0019] In one possible implementation, constructing a projection function that maps latitude and longitude coordinates to two-dimensional coordinates on a plane based on the actual drawing area and the bounding box includes:
[0020] Calculate a first ratio of the width of the actual drawing area to the longitude span value of the bounding box, and a second ratio of the height of the actual drawing area to the latitude span value of the bounding box, wherein the longitude span value is the difference between the minimum longitude value and the maximum longitude value, and the latitude span value is the difference between the minimum latitude value and the maximum latitude value;
[0021] The minimum value between the first ratio and the second ratio is used as the uniform scaling ratio;
[0022] Calculate the horizontal offset and vertical offset based on the preset margin parameters, the actual drawing area, the bounding box, and the uniform scaling ratio;
[0023] Based on the uniform scaling ratio, the horizontal offset, the vertical offset, and the bounding box, a projection function is constructed to map latitude and longitude coordinates to two-dimensional coordinates on a plane.
[0024] In one possible implementation, the step of traversing each latitude and longitude coordinate in the geographic data format and sequentially calling the projection function to calculate the screen coordinates of the latitude and longitude coordinates on the target vector canvas includes:
[0025] For each of the latitude and longitude coordinates, the first horizontal coordinate corresponding to the longitude coordinate and the first vertical coordinate corresponding to the latitude coordinate are calculated based on the uniform scaling ratio.
[0026] The horizontal first coordinate is offset according to the horizontal offset to obtain the horizontal second coordinate;
[0027] The first longitudinal coordinate is offset according to the longitudinal offset to obtain the second longitudinal coordinate;
[0028] The vertical second coordinate is reversed to obtain the vertical third coordinate;
[0029] The second horizontal coordinate and the third vertical coordinate are used as the screen coordinates of the latitude and longitude coordinates on the target vector canvas.
[0030] In one possible implementation, generating vector graphic path data based on each of the screen coordinates and embedding the vector graphic path data into the display interface to show the trajectory includes:
[0031] Arrange all the screen coordinates obtained from the traversal calculation in the original order of latitude and longitude coordinates to form a screen coordinate sequence;
[0032] Generate a path movement instruction for the first screen coordinate in the screen coordinate sequence, and generate a path segment connection instruction for each of the remaining screen coordinates in the screen coordinate sequence in sequence.
[0033] By combining the path movement command and the path segment connection command, vector graphic path data for describing the trajectory shape is generated;
[0034] The vector graphic path data is embedded into the display interface to show the trajectory.
[0035] In one possible implementation, the vector graphic path data is described in SVG format, and the display interface loads the vector graphic path data through SVG path elements and renders and displays the trajectory based on preset trajectory color, line width parameters, and fill attributes.
[0036] Secondly, embodiments of this application provide an unmanned vehicle trajectory rendering device, comprising:
[0037] The first processing module is used to acquire a continuous sequence of latitude and longitude coordinates collected by the unmanned vehicle, and convert the latitude and longitude coordinate sequence into a standardized geographic data format, wherein the geographic data format contains at least linear elements describing the geometry of the trajectory.
[0038] The second processing module is used to calculate the bounding box of the trajectory based on the geographic data format, and to construct a projection function that maps latitude and longitude coordinates to two-dimensional coordinates on a plane according to the size parameters of the target vector canvas and the bounding box.
[0039] The calculation module is used to traverse each of the latitude and longitude coordinates in the geographic data format and sequentially call the projection function to calculate the screen coordinates of the latitude and longitude coordinates on the target vector canvas;
[0040] The rendering module is used to generate vector graphic path data based on each screen coordinate and embed the vector graphic path data into the display interface to display the trajectory.
[0041] In one possible implementation, the first processing module is specifically used for:
[0042] The latitude and longitude coordinate sequence is organized into a line-type geometric object in GeoJSON format;
[0043] The geometric object is encapsulated as a collection of features containing geographic feature structures.
[0044] In one possible implementation, the second processing module is specifically used for:
[0045] Iterate through the latitude and longitude coordinates in the geographic data format and determine the minimum longitude value, maximum longitude value, minimum latitude value, and maximum latitude value among all latitude and longitude coordinates;
[0046] A bounding box is generated based on the minimum longitude value, maximum longitude value, minimum latitude value, and maximum latitude value to enclose the entire trajectory;
[0047] The actual drawing area is determined based on the width, height, and preset margin parameters of the target vector canvas. The actual drawing area includes the width and height of the actual drawing area.
[0048] Based on the actual drawing area and the bounding box, a projection function is constructed to map latitude and longitude coordinates to two-dimensional coordinates on a plane.
[0049] In one possible implementation, the second processing module is specifically used for:
[0050] Calculate a first ratio of the width of the actual drawing area to the longitude span value of the bounding box, and a second ratio of the height of the actual drawing area to the latitude span value of the bounding box, wherein the longitude span value is the difference between the minimum longitude value and the maximum longitude value, and the latitude span value is the difference between the minimum latitude value and the maximum latitude value;
[0051] The minimum value between the first ratio and the second ratio is used as the uniform scaling ratio;
[0052] Calculate the horizontal offset and vertical offset based on the preset margin parameters, the actual drawing area, the bounding box, and the uniform scaling ratio;
[0053] Based on the uniform scaling ratio, the horizontal offset, the vertical offset, and the bounding box, a projection function is constructed to map latitude and longitude coordinates to two-dimensional coordinates on a plane.
[0054] In one possible implementation, the computing module is specifically used for:
[0055] For each of the latitude and longitude coordinates, the first horizontal coordinate corresponding to the longitude coordinate and the first vertical coordinate corresponding to the latitude coordinate are calculated based on the uniform scaling ratio.
[0056] The horizontal first coordinate is offset according to the horizontal offset to obtain the horizontal second coordinate;
[0057] The first longitudinal coordinate is offset according to the longitudinal offset to obtain the second longitudinal coordinate;
[0058] The vertical second coordinate is reversed to obtain the vertical third coordinate;
[0059] The second horizontal coordinate and the third vertical coordinate are used as the screen coordinates of the latitude and longitude coordinates on the target vector canvas.
[0060] In one possible implementation, the rendering module is specifically used for:
[0061] Arrange all the screen coordinates obtained from the traversal calculation in the original order of latitude and longitude coordinates to form a screen coordinate sequence;
[0062] Generate a path movement instruction for the first screen coordinate in the screen coordinate sequence, and generate a path segment connection instruction for each of the remaining screen coordinates in the screen coordinate sequence in sequence.
[0063] By combining the path movement command and the path segment connection command, vector graphic path data for describing the trajectory shape is generated;
[0064] The vector graphic path data is embedded into the display interface to show the trajectory.
[0065] In one possible implementation, the vector graphic path data is described in SVG format, and the display interface loads the vector graphic path data through SVG path elements and renders and displays the trajectory based on preset trajectory color, line width parameters, and fill attributes.
[0066] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0067] The memory stores computer-executed instructions;
[0068] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0069] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0070] The unmanned vehicle trajectory rendering method, apparatus, device, and medium provided in this application first acquire a continuous latitude and longitude coordinate sequence collected during the unmanned vehicle's operation, and converts the latitude and longitude coordinate sequence into a standardized geographic data format. By encapsulating discrete trajectory points using a unified data organization structure, the trajectory data gains standardized descriptive capabilities, facilitating subsequent coordinate analysis, trajectory calculation, and cross-system data interaction. Then, the bounding box of the trajectory is calculated based on the geographic data format, and a projection function mapping the latitude and longitude coordinates to two-dimensional planar coordinates is constructed based on the size parameters of the target vector canvas and the bounding box. This ensures that the trajectory maintains its original aspect ratio during scaling, avoiding trajectory distortion, and simultaneously achieving centered display of the trajectory on the canvas, improving performance. The system ensures the completeness and visualization of the trajectory display. Subsequently, it iterates through each latitude and longitude coordinate in the geographic data format and sequentially calls the projection function to calculate the screen coordinates of each coordinate on the target vector canvas. This involves converting spherical geographic coordinates into planar coordinates suitable for 2D graphics rendering, thereby achieving accurate positioning of the trajectory data in screen space and improving trajectory rendering accuracy and display consistency. Finally, it generates vector graphic path data based on each screen coordinate and embeds this data into the display interface to show the trajectory. Because it uses a vectorized trajectory description method, the trajectory edges remain clear and undistorted at different scaling ratios, while reducing graphic data redundancy and lowering system resource consumption. This achieves lightweight, high-performance visualization rendering of the autonomous vehicle trajectory. Attached Figure Description
[0071] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0072] Figure 1 A flowchart illustrating the unmanned vehicle trajectory rendering method provided in this application embodiment. Figure 1 ;
[0073] Figure 2 A flowchart illustrating the unmanned vehicle trajectory rendering method provided in this application embodiment. Figure 2 ;
[0074] Figure 3 This is a schematic diagram of the structure of the unmanned vehicle trajectory rendering device provided in the embodiments of this application;
[0075] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0076] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0077] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0078] With the rapid development of unmanned vehicle (autonomous vehicles, logistics delivery robots, inspection robots, etc.) technology, the demand for high-precision trajectory visualization has exploded in many fields. For example, in logistics, unmanned vehicles need to display their transportation routes in real time to optimize route planning; in industrial inspection scenarios, unmanned vehicles use high-precision GPS recording devices to record inspection trajectories, and the trajectory data needs to be presented to maintenance personnel in an intuitive way; in agricultural unmanned vehicle operations, trajectory visualization can help analyze the operation coverage area and efficiency. However, traditional map rendering technology faces significant challenges in these scenarios: the trajectory data collected by unmanned vehicles usually contains massive amounts of high-precision latitude and longitude coordinates (such as centimeter-level accuracy), and needs to be loaded, zoomed, and interacted with quickly on the web. Therefore, there is an urgent need for a lightweight, high-performance trajectory rendering method to meet the real-time visualization requirements of high-precision trajectory data of unmanned vehicles on the web, while reducing system complexity and development barriers.
[0079] Existing technologies typically employ trajectory rendering solutions based on open-source map libraries. For example, they utilize front-end map frameworks such as Mapbox GLJS and Leaflet. This involves loading base map tiles, initializing a map container, converting GPS trajectory point data uploaded by the autonomous vehicle into standard geographic data formats like GeoJSON, and then calling the polyline drawing interface provided by the map library to connect multiple latitude and longitude coordinates in chronological order to form a trajectory path. Furthermore, to support features such as trajectory zooming, panning, and dynamic refresh, a rendering module, a coordinate projection transformation module, and an event interaction component are usually required to complete the trajectory visualization.
[0080] While existing technologies can achieve relatively complete map interaction capabilities, the open-source map libraries themselves are designed for general map scenarios. They integrate a large amount of base map management, layer control, style systems, spatial projection, and complex interaction logic, resulting in a large overall library file size. This leads to significant functional redundancy in scenarios where autonomous vehicles only need to display high-precision trajectories. This not only increases the size of the front-end application package and page loading latency but also easily causes rendering performance degradation when processing high-frequency, high-density trajectory point data. Furthermore, when customized trajectory effects, dynamic trajectory playback, or special coordinate transformation logic are required for autonomous vehicle applications, a deep understanding of the open-source library's internal rendering mechanism and plugin system is necessary, resulting in high development and maintenance costs. Additionally, version compatibility issues may exist between various third-party dependent components, increasing system complexity and making it difficult to meet the lightweight, high-performance, and loosely coupled web-based visualization requirements of high-precision trajectory data for autonomous vehicles.
[0081] To address the issues of functional redundancy, high resource consumption, insufficient rendering performance, and high complexity of customized development in existing technologies using general open-source map libraries for autonomous vehicle trajectory rendering, the inventors recognized that the core requirements in high-precision autonomous vehicle trajectory visualization scenarios mainly focus on coordinate transformation and path drawing of trajectory data, rather than complex base map management, layer control, and general map interaction capabilities. Therefore, they proposed an autonomous vehicle trajectory rendering method. Specifically, the continuous latitude and longitude coordinate sequence collected by the autonomous vehicle is first converted into a standardized geographic data format to achieve unified organization and structured expression of trajectory data. Then, by calculating the trajectory bounding box and combining it with the target vector canvas size, a projection function between geographic coordinates and two-dimensional plane coordinates is constructed to complete the coordinate mapping of high-precision trajectory points. Subsequently, vector graphic path data is generated based on the mapped screen coordinates, and trajectory drawing is directly completed using the native rendering capabilities of SVG, without relying on third-party map libraries and complex plugin systems. By adopting the above methods, we can not only significantly reduce the front-end resource consumption and system coupling, reduce the application package size and page loading latency, but also improve the rendering efficiency and display smoothness of high-frequency and high-density trajectory data, while reducing the cost of customized development and later maintenance, thereby realizing lightweight, high-performance and high-precision visualization of unmanned vehicle trajectory data on the Web.
[0082] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0083] Figure 1 A flowchart illustrating the unmanned vehicle trajectory rendering method provided in this application embodiment. Figure 1;like Figure 1 As shown, the method includes:
[0084] S101. Obtain the continuous latitude and longitude coordinate sequence collected by the unmanned vehicle, and convert the latitude and longitude coordinate sequence into a standardized geographic data format.
[0085] The geographic data format must include at least linear elements that describe the geometry of the trajectory.
[0086] It should be understood that autonomous vehicles typically output location data continuously through onboard GPS components during operation. Each location data point includes at least longitude and latitude values, as well as time information corresponding to the time of collection. In some implementations, additional fields such as heading angle, speed, positioning status, task identifier, and vehicle identifier may also be included. Here, a continuous sequence of latitude and longitude coordinates refers to a set of multiple geographic coordinate points arranged in chronological order of collection time. This continuity can be reflected both in continuous sampling over time and in the continuous attribution of trajectory points in business logic, such as location records generated by the same task, the same path playback interval, or the same vehicle within a specified time window.
[0087] In one possible implementation, the latitude and longitude coordinate sequence is first organized into a line-type geometric object in GeoJSON format; then the geometric object is encapsulated into a collection of features containing geographic feature structures.
[0088] It's important to note that the Geographic JavaScript Object Notation (GeoJSON) structure format is a JSON-based structured data format used to express geospatial data. It describes geometric types, coordinate arrays, and attribute information using unified key-value fields. Linear geometric objects correspond to the LineString structure in GeoJSON, with their coordinate members arranged chronologically according to the time of data collection by the autonomous vehicle, representing the spatial polyline shape of continuous trajectories. Feature collections correspond to the FeatureCollection structure in GeoJSON, which encapsulates single or multiple geographic features and organizes geometric and attribute information uniformly for easy parsing, transmission, and rendering. A geographic feature structure refers to a data unit composed of feature identifiers, geometric objects, and attribute fields. Its attribute fields can carry information such as trajectory name, task number, collection time, vehicle number, or display style tags.
[0089] In the specific implementation, after receiving the latitude and longitude coordinate sequence continuously output by the autonomous vehicle positioning module, the backend system first performs sequence verification, outlier removal, and field standardization on the coordinate data to ensure that each coordinate point contains at least longitude and latitude fields. Then, the processed coordinate points are sequentially written into a GeoJSON coordinate array, and a line-type geometric object is generated using "LineString" as the geometric type, thereby organizing the discrete coordinates into a standardized object that can directly express the trajectory shape. Further, the system embeds this geometric object into a feature object and writes attribute fields corresponding to the trajectory into the feature object. Finally, the feature object is encapsulated into a feature collection for output. This encapsulated data can be directly parsed by the frontend into a unified geographic data representation format. In practical applications, other attribute fields can be extended according to business needs; this embodiment does not limit this.
[0090] Understandably, this implementation converts latitude and longitude coordinate sequences into a universal and parsable standardized geographic data format, reducing data coupling between the front-end and back-end and improving the consistency and compatibility of trajectory data exchange. Simultaneously, the encapsulation of linear geometric objects and feature sets makes trajectory representation more complete, facilitating trajectory display, playback, annotation, and extended attribute management, thereby improving the processing efficiency of autonomous vehicle trajectory visualization and the convenience of system maintenance.
[0091] S102. Calculate the bounding box of the trajectory based on the geographic data format, and construct a projection function that maps latitude and longitude coordinates to two-dimensional coordinates on a plane according to the size parameters of the target vector canvas and the bounding box.
[0092] It should be understood that, in this embodiment, the bounding box can be understood as the smallest circumscribed rectangle surrounding the entire trajectory. It is typically composed of four boundary values: minimum longitude, maximum longitude, minimum latitude, and maximum latitude, used to reflect the coverage area of the entire trajectory in geographic space. The target vector canvas is the two-dimensional drawing area that carries the trajectory visualization results. It can be an SVG (Scalable Vector Graphics) container in an HTML (HyperText Markup Language) page, or other native browser graphics containers that support vector drawing. Its size parameters typically include canvas width, height, and margin values set to avoid graphics clipping to the edges. The projection function here refers to the mapping rule that converts latitude and longitude coordinates into screen plane coordinates. Its core function is to directly establish the mathematical relationship between the geographic range and the pixel range without relying on the complete coordinate system of a general map library, enabling the trajectory to be accurately drawn onto the specified canvas.
[0093] Understandably, this embodiment avoids the problem of relying on the map library's internal projection system, the underlying layer state, and the viewport controller to jointly participate in coordinate transformation, by establishing a direct mapping relationship between the trajectory's geospatial space and the page's pixel space. By calculating the bounding box only around the trajectory itself and constructing a lightweight mapping function, the dependence on the complex map operating environment during the front-end initialization stage can be significantly reduced while ensuring the recognizability of the geometric shape. At the same time, the combined effect of proportional scaling and margin control ensures that the trajectory can be fully contained within the canvas area without distortion due to scale imbalance, thereby improving the accuracy and readability of high-precision trajectory display.
[0094] It should be noted that the specific implementation steps of this embodiment are as follows: Figure 2 The embodiments are described in detail, and will not be repeated here.
[0095] S103. Iterate through each latitude and longitude coordinate in the geographic data format and call the projection function in turn to calculate the screen coordinates of the latitude and longitude coordinates on the target vector canvas.
[0096] It should be understood that, in this embodiment, screen coordinates refer to pixel position coordinates applicable to a browser's two-dimensional drawing environment, typically composed of horizontal and vertical coordinate values. Calling the projection function sequentially for each latitude and longitude coordinate means that the trajectory points participate in coordinate transformation one by one according to their original order, thus ensuring that the generated sequence of screen points, after connection, maintains a motion path order consistent with the original trajectory. Since the essence of trajectory rendering is to visually represent the geometric connection results of the point sequence, this step is not merely a simple coordinate value conversion, but also plays a role in maintaining the trajectory topological order, controlling processing efficiency, and connecting the final vector path generation.
[0097] In practice, the `coordinates` array can be read from linear features in a standardized geographic data format, and a traversal pointer can be established. For each latitude and longitude coordinate point read, the projection function built in the previous step is called to convert the point from geographic coordinate space to pixel planar coordinate space, and the calculation result is appended and saved to the screen coordinate array. For scenarios with a large number of trajectory points, a streaming processing mode can be adopted, that is, reading, converting, and writing the results to the cache simultaneously, without requiring multiple copies of intermediate data to be stored in memory at the same time. This can effectively reduce browser memory usage.
[0098] To further balance rendering efficiency and display quality, in one possible embodiment, this step can be simplified by incorporating trajectory point density. For example, if multiple adjacent latitude and longitude points fall near the same pixel after projection or the direction of their connection changes very little, some of these points can be skipped, retaining only the key points that affect the overall polyline shape, thus reducing the length of subsequent path instructions. This simplification can be pre-judged based on geographic coordinate differences before projection, or it can be determined after projection based on changes in screen pixel distance and angle. This processing reduces invalid coordinate transformations and browser path parsing pressure, while visually maintaining the overall contour of the trajectory. If business requirements emphasize the complete restoration of a high-precision route, downsampling logic can be disabled, and projection calculations can be performed directly on each original point.
[0099] It should be understood that this step, through an orderly and scalable coordinate transformation method, further transforms standardized geographic data into a set of screen points that the browser can directly consume. This maintains the geometric order of the trajectory and allows for control of resource consumption through streaming processing, batch processing, background threads, and sampling strategies. As a result, it improves the computational stability and rendering response speed of the page in high-precision, large-volume trajectory scenarios.
[0100] S104. Generate vector graphic path data based on each screen coordinate, and embed the vector graphic path data into the display interface to show the trajectory.
[0101] In one possible implementation, all screen coordinates obtained through traversal calculation are first arranged in the original order of latitude and longitude coordinates to form a screen coordinate sequence; then, the first screen coordinate in the screen coordinate sequence is used to generate a path movement instruction, and each of the remaining screen coordinates in the screen coordinate sequence is used to generate a path segment connection instruction in turn; then, the path movement instruction and the path segment connection instruction are concatenated to generate vector graphic path data for describing the trajectory shape; finally, the vector graphic path data is embedded into the display interface to display the trajectory.
[0102] It should be understood that, in this embodiment, vector graphic path data refers to structured drawing data capable of describing a continuous polyline path on the browser side. It can be a path instruction string in SVG, or a data object composed of multiple polyline point sets, line segments, or other vector representation structures. The display interface refers to the webpage display area in the autonomous vehicle business system. This area can be a trajectory playback page, vehicle operation monitoring page, task review page, or mobile terminal browsing page in the scheduling platform. Embedding the path data into the display interface means that the trajectory is directly displayed to the user using the browser's native graphics rendering capabilities, without needing to load a complete third-party map library or map base rendering framework. The screen coordinate sequence is used to maintain the sequential relationship of trajectory points, avoiding reversal of trajectory polyline direction or incorrect line connection due to reordering. The path movement instruction is used to indicate the drawing start point, and the path segment connection instruction is used to sequentially connect subsequent screen coordinates into a continuous polyline. The generated vector graphic path data can be organized in the form of an SVG path description string so that it can be natively parsed by the browser.
[0103] In the specific implementation, after obtaining the screen coordinates, the front end stores them sequentially into a coordinate array according to the original latitude and longitude acquisition order. Then, it reads the first element of the array to generate a starting positioning command, and generates line connection commands for each of the remaining elements. Finally, it concatenates these commands in sequence to form complete path data. This path data can be written into the path attributes of an SVG container, or it can be inserted into the page DOM after creating path nodes via a script, thus displaying the trajectory as a vector polyline in the target area. To meet different display requirements, the path data can also be supplemented with line width, color, and transparency attributes. Other models can also be selected in practical applications; this embodiment does not limit this selection.
[0104] Understandably, this method directly converts trajectory coordinates into path commands, eliminating the overhead of complex layer rendering and additional coordinate organization, enabling the trajectory to be quickly generated and stably displayed on the interface. Because the path data retains the original coordinate order, the displayed trajectory is consistent with the actual direction of the autonomous vehicle's movement, and it facilitates incremental stitching and dynamic updates when loading new coordinates. This improves the rendering efficiency, display clarity, and cross-platform adaptability of trajectory displays on web pages, while reducing reliance on third-party map libraries.
[0105] It should be noted that the vector graphic path data is described in SVG format. The display interface loads the vector graphic path data through SVG path elements and renders the trajectory based on preset trajectory colors, line width parameters, and fill attributes.
[0106] It should be understood that, in this embodiment, the SVG format is used to standardize the vector representation of the trajectory path. Its path data can be natively parsed by the browser and adaptively scaled according to resolution, thus maintaining a clear and consistent trajectory outline on display terminals of different sizes. SVG path elements can be set as embedded nodes or dynamically created nodes. The path attributes of the nodes are used to write path instructions after screen coordinate transformation, enabling the trajectory to be directly loaded and displayed in the SVG container of the page. The trajectory color is used to distinguish different vehicles, different task states, or different running stages. The line width parameter is used to control the visual thickness of the trajectory lines. The fill attribute is used to specify whether the path is filled and its filling effect, so that the trajectory can be presented as a simple line outline or as a graphic area with a clear visual emphasis effect. Preset parameters can be obtained from front-end configuration items, back-end parameters, or page interaction input. In practical applications, other models or implementation methods can also be selected, and this embodiment does not limit this.
[0107] In practice, the front-end converts the generated trajectory path data into SVG path statements and writes them into the corresponding path element. The browser then performs vector rendering on this element and completes the style drawing based on color, line width, and fill attributes, thereby displaying the autonomous vehicle's trajectory on the interface in a high-precision manner. Because a vector graphics representation is used, the trajectory maintains stable geometric relationships under scaling, translation, or different screen resolutions, without producing obvious jagged edges or distortion. At the same time, it reduces dependence on third-party map libraries, lowers page resource consumption, and reduces maintenance complexity.
[0108] It is understandable that the trajectory display in this embodiment can leverage the native rendering capabilities of SVG to achieve good cross-platform compatibility and display clarity, and makes the trajectory style highly configurable, facilitating customized presentation in scenarios such as unmanned vehicle scheduling, playback analysis, and operation monitoring. Due to the shorter rendering chain, page initialization and trajectory refresh efficiency are improved, resulting in a lighter and more stable overall display, suitable for deployment on terminal devices with different performance levels.
[0109] The unmanned vehicle trajectory rendering method provided in this application first acquires a continuous latitude and longitude coordinate sequence collected during the unmanned vehicle's operation, and converts the latitude and longitude coordinate sequence into a standardized geographic data format. It then encapsulates discrete trajectory points using a unified data organization structure, enabling the trajectory data to have standardized descriptive capabilities, thus facilitating subsequent coordinate analysis, trajectory calculation, and cross-system data interaction. Next, it calculates the trajectory's bounding box based on the geographic data format, and constructs a projection function that maps the latitude and longitude coordinates to two-dimensional planar coordinates based on the target vector canvas's size parameters and the bounding box. This ensures that the trajectory maintains its original aspect ratio during scaling, avoiding trajectory distortion, and simultaneously achieving centered display of the trajectory on the canvas, improving trajectory presentation. Completeness and visualization effects are achieved. Subsequently, each latitude and longitude coordinate in the geographic data format is traversed, and the projection function is called sequentially to calculate the screen coordinates of each latitude and longitude coordinate on the target vector canvas. That is, by converting the spherical geographic coordinates into planar coordinates suitable for two-dimensional graphics rendering, the trajectory data can be accurately positioned in screen space, thereby improving the trajectory drawing accuracy and display consistency. Finally, vector graphic path data is generated based on each screen coordinate, and the vector graphic path data is embedded into the display interface to display the trajectory. Due to the use of vectorized trajectory description, the trajectory edges can be kept clear and undistorted at different scaling ratios, while reducing graphic data redundancy and reducing system resource consumption, thereby achieving lightweight and high-performance visualization rendering of the autonomous vehicle trajectory.
[0110] Figure 2 A flowchart illustrating the unmanned vehicle trajectory rendering method provided in this application embodiment. Figure 2 ;like Figure 2 As shown, in this embodiment... Figure 1 Based on the examples, the process of constructing the projection function is described in detail, and the method includes:
[0111] S201. Traverse the latitude and longitude coordinates in the geographic data format and determine the minimum longitude value, maximum longitude value, minimum latitude value, and maximum latitude value for each of the latitude and longitude coordinates.
[0112] It should be understood that in this embodiment, all coordinate points in the linear feature are first traversed, and the longitude and latitude are compared respectively to obtain the minimum longitude minLon, maximum longitude maxLon, minimum latitude minLat, and maximum latitude maxLat, thereby forming the bounding box. If the trajectory contains only a single point or the longitude and latitude range is too small, causing the bounding box to degenerate, a minimum expansion amount can be added to the boundary values to prevent division by zero errors or the drawing of graphics squeezed into a single pixel area during subsequent calculations.
[0113] Specifically, this embodiment determines the coverage area of the trajectory data in geographic space by statistically analyzing the latitude and longitude range of all trajectory points, thereby providing a unified spatial reference range for subsequent coordinate scaling and screen mapping. In the specific implementation process, each latitude and longitude coordinate can be read sequentially from a GeoJSON formatted LineString geometric object, and the current minimum longitude value, maximum longitude value, minimum latitude value, and maximum latitude value are updated respectively using a point-by-point comparison method. When the current latitude and longitude range is detected to be less than a preset threshold, a preset expansion amount can be automatically added to the perimeter of the bounding box, for example, adding a latitude and longitude compensation range of 0.0001° to ensure the stability of subsequent scaling calculations. For example, when the trajectory points collected by the autonomous vehicle include (116.397, 39.909), (116.405, 39.915), and (116.412, 39.922), by traversing all coordinate points, minLon=116.397, maxLon=116.412, minLat=39.909, and maxLat=39.922 can be obtained, thereby determining the effective boundary range of the trajectory in geospatial space.
[0114] Understandably, the above method can accurately determine the spatial distribution range of the autonomous vehicle trajectory, providing a unified boundary basis for subsequent coordinate projection and trajectory scaling, avoiding calculation anomalies caused by too few trajectory points or too small boundary range, and improving the stability and reliability of the trajectory rendering process.
[0115] S202. Generate a bounding box to enclose the entire trajectory based on the minimum longitude value, maximum longitude value, minimum latitude value, and maximum latitude value.
[0116] It should be understood that a rectangular geographic region is constructed based on the minimum longitude, maximum longitude, minimum latitude, and maximum latitude values to completely enclose all trajectory points, thus establishing a unified spatial coordinate reference for the trajectory data. In practice, the minimum longitude and minimum latitude values can be used as the coordinates of the lower left corner of the bounding box, and the maximum longitude and maximum latitude values as the coordinates of the upper right corner, forming a rectangular bounding box data structure describing the trajectory coverage. The bounding box not only reflects the overall distribution range of the trajectory but also serves as the basic parameter for subsequent calculations of scaling, coordinate offset, and trajectory centering. For example, for the aforementioned autonomous vehicle trajectory data, a bounding box can be generated: {minLon=116.397, maxLon=116.412, minLat=39.909, maxLat=39.922}, thereby constructing a geographic area completely enclosing the autonomous vehicle's operating trajectory.
[0117] It is understandable that by generating a unified trajectory bounding box, a standardized spatial reference area can be established for subsequent two-dimensional plane mapping, enabling autonomous vehicle trajectories of different lengths and ranges to be adaptively scaled and fully displayed within the target display area, thereby improving the consistency and completeness of trajectory visualization.
[0118] S203. Determine the actual drawing area based on the width, height, and preset margin parameters of the target vector canvas.
[0119] The actual drawing area includes the actual drawing area width and the actual drawing area height.
[0120] It should be understood that the actual drawing area width = SVG width - 2 × preset margin parameter; the actual drawing area height = SVG width - 2 × preset margin parameter. By subtracting the preset margin area from the total size of the target vector canvas, the effective display area that can be used for trajectory drawing is obtained, thus avoiding the problem of display crowding or partial clipping caused by the trajectory graphic being too close to the canvas edge. In the specific implementation process, a uniform margin parameter can be preset, such as 20 pixels or 40 pixels, and the two side margin values can be subtracted according to the width and height of the target vector canvas to obtain the actual drawing area width and actual drawing area height. For example, when the target SVG canvas size is 800×600 pixels and the margin parameter is 20 pixels, the actual drawing area width is 760 pixels and the actual drawing area height is 560 pixels. Subsequently, subsequent trajectory coordinate mapping and path drawing can be performed based on this actual drawing area.
[0121] Understandably, by setting the actual drawing area, the visual white space of the trajectory graphic in the display interface can be guaranteed, avoiding the trajectory from being displayed along the edge, improving the aesthetics and readability of the trajectory display, and providing a stable display area basis for the centered layout and unified scaling of the trajectory.
[0122] S204. Based on the actual drawing area and bounding box, construct a projection function that maps latitude and longitude coordinates to two-dimensional coordinates on a plane.
[0123] In one possible implementation, firstly, a first ratio of the actual drawing area width to the longitude span of the bounding box and a second ratio of the actual drawing area height to the latitude span of the bounding box are calculated; then, the minimum of the first and second ratios is used as the uniform scaling ratio; next, based on preset margin parameters, the actual drawing area, the bounding box, and the uniform scaling ratio, the lateral and vertical offsets are calculated; finally, based on the uniform scaling ratio, the lateral and vertical offsets, and the bounding box, a projection function that maps latitude and longitude coordinates to two-dimensional planar coordinates is constructed.
[0124] The longitude span is the difference between the minimum and maximum longitude values, and the latitude span is the difference between the minimum and maximum latitude values. A uniform scaling factor is used to perform coordinate conversion using the same ratio in both the horizontal and vertical directions, thus maintaining a consistent trajectory shape proportion. Lateral and vertical offsets are used to translate and correct the scaled trajectory coordinates, ensuring the trajectory is centered or aligned within the actual drawing area according to preset margins.
[0125] It should be understood that by establishing a unified proportional mapping relationship between the geographic spatial range and the target display area, the unmanned vehicle trajectory can be displayed in a two-dimensional plane with equal scaling. Combined with a position offset mechanism, the trajectory is automatically centered, thus ensuring the integrity of the trajectory display and the consistency of its spatial form. In the specific implementation process, firstly, the longitude span value is calculated based on the maximum and minimum longitude values within the bounding box, and the latitude span value is calculated based on the maximum and minimum latitude values. Subsequently, a first ratio is obtained by dividing the actual drawing area width by the longitude span value, and a second ratio is obtained by dividing the actual drawing area height by the latitude span value. Since the longitude and latitude span may not be consistent with the canvas width-to-height ratio, using two separate ratios for scaling can easily lead to stretching and deformation of the trajectory in the horizontal or vertical directions. Therefore, this implementation selects the smaller of the first and second ratios as the unified scaling ratio to ensure that the trajectory maintains its original spatial proportions during scaling. Next, the actual size of the trajectory within the actual drawing area is calculated based on a uniform scaling ratio. Then, the horizontal and vertical offsets are calculated using preset margin parameters to ensure the trajectory is centered on the target vector canvas. Finally, a projection function is constructed based on the uniform scaling ratio, horizontal and vertical offsets, and the bounding box. Upon receiving any latitude and longitude coordinates, the corresponding two-dimensional screen coordinates can be quickly calculated using the projection function, achieving the mapping and transformation from latitude and longitude coordinates to planar vector coordinates.
[0126] For example, when the target vector canvas size is 800×600 pixels and the margin parameter is 20 pixels, the actual drawing area width is 760 pixels and the actual drawing area height is 560 pixels. If the longitude span value corresponding to the bounding box is 0.015 and the latitude span value is 0.013, then the first ratio can be calculated to be approximately 50666 and the second ratio to be approximately 43076, and the smaller value of 43076 is taken as the uniform scaling ratio. Subsequently, the horizontal and vertical offsets are calculated based on the actual size of the scaled trajectory, so that the trajectory can be displayed completely and centered within the SVG canvas.
[0127] Understandably, this projection function construction method can adaptively determine scaling and offset parameters based on the trajectory's own boundaries and the available canvas area, ensuring the trajectory falls completely within the drawing area during display and maintaining its original geometry without stretching or distortion. Since the uniform scaling ratio is taken from the smaller of the ratios in two directions, it avoids the trajectory exceeding boundaries or being partially clipped, while also improving display consistency across canvases of different sizes. With the correction of horizontal and vertical offsets, the trajectory can also achieve a more stable visual layout within preset margins, thereby improving the accuracy, readability, and adaptability of the autonomous vehicle trajectory webpage display.
[0128] It should be noted that, based on the data obtained above, the specific method for calculating screen coordinates is as follows:
[0129] First, for each latitude and longitude coordinate, calculate the first horizontal coordinate corresponding to the longitude coordinate and the first vertical coordinate corresponding to the latitude coordinate based on a uniform scaling ratio. Then, perform position offset processing on the first horizontal coordinate according to the horizontal offset to obtain the second horizontal coordinate. Then, perform position offset processing on the first vertical coordinate according to the vertical offset to obtain the second vertical coordinate. Next, reverse the coordinate axis direction of the second vertical coordinate to obtain the third vertical coordinate. Finally, use the second horizontal coordinate and the third vertical coordinate as the screen coordinates of the latitude and longitude coordinates on the target vector canvas.
[0130] The uniform scaling factor maps latitude and longitude to the canvas coordinate system using the same linear coefficient, ensuring consistent geometric relationships of the trajectory in both horizontal and vertical directions. Horizontal and vertical offsets translate the mapped coordinates into the target drawing area, allowing the trajectory to be displayed completely within the set margins. The vertical axis reversal eliminates the difference between the geographic coordinate system and the vector canvas coordinate system along the vertical axis, ensuring the trajectory displays a consistent vertical orientation on the page compared to its original geographic location.
[0131] It should be understood that by uniform scaling, position offset, and coordinate axis direction transformation, the latitude and longitude coordinates in geographic space are converted into screen coordinates suitable for display on a two-dimensional vector canvas, thereby enabling accurate drawing of the autonomous vehicle trajectory on the display interface. In the specific implementation process, the minimum longitude and minimum latitude values within the bounding box are first used as reference points to normalize the current latitude and longitude coordinates. The corresponding first horizontal and first vertical coordinates are then calculated using a uniform scaling ratio. The first horizontal coordinate is obtained by multiplying the difference between the current longitude value and the minimum longitude value by the uniform scaling ratio, and the first vertical coordinate is obtained by multiplying the difference between the current latitude value and the minimum latitude value by the uniform scaling ratio, thus achieving a proportional mapping between geographic distance and screen distance. Subsequently, to ensure that the trajectory is within the effective display area of the target vector canvas, the first horizontal coordinate is translated using a horizontal offset to obtain a second horizontal coordinate, and the first vertical coordinate is translated using a vertical offset to obtain a second vertical coordinate. Since most 2D vector canvases use the top-left corner as the origin and the vertical coordinates increase from top to bottom, while the latitude direction in geographic coordinates usually increases from bottom to top, it is necessary to reverse the axis direction of the second vertical coordinate to obtain the third vertical coordinate, ensuring that the trajectory display direction is consistent with the actual geographic direction. Finally, the second horizontal coordinate and the third vertical coordinate are used together as the screen coordinates corresponding to the current latitude and longitude coordinates for subsequent trajectory path drawing.
[0132] For example, if the target SVG canvas height is 600 pixels, and the vertical second coordinate of a certain trajectory point is 120 pixels after projection calculation, the vertical third coordinate of 480 pixels can be obtained by the method of "600-120", thereby realizing the vertical coordinate axis reversal; then, the corresponding horizontal second coordinate and vertical third coordinate are combined to form the final display position of the trajectory point in the SVG canvas.
[0133] Understandably, this implementation method uses unified scaling, offset correction, and vertical axis reversal to stably convert geographical latitude and longitude into canvas screen coordinates, which can avoid problems such as scale distortion, position offset, and upside down when displaying the trajectory. At the same time, it reduces the dependence on the coordinate system of general map library and improves the directness and controllability of trajectory rendering on the web.
[0134] After adopting this implementation method, latitude and longitude points can be accurately mapped to the target vector canvas according to the preset boundary. The trajectory display results are more consistent with the original path shape, and the coordinate calculation process is simple and clear, which facilitates the front end to execute quickly and repeat rendering, thereby improving the response efficiency, display consistency and deployment flexibility of unmanned vehicle trajectory visualization.
[0135] Figure 3This is a schematic diagram of the structure of the unmanned vehicle trajectory rendering device provided in the embodiments of this application; as shown below. Figure 3 As shown, the device includes:
[0136] The first processing module 301 is used to acquire the continuous latitude and longitude coordinate sequence collected by the unmanned vehicle and convert the latitude and longitude coordinate sequence into a standardized geographic data format, which at least includes linear elements describing the geometric shape of the trajectory.
[0137] The second processing module 302 is used to calculate the bounding box of the trajectory based on the geographic data format, and to construct a projection function that maps latitude and longitude coordinates to two-dimensional coordinates on a plane according to the size parameters of the target vector canvas and the bounding box.
[0138] The calculation module 303 is used to traverse each latitude and longitude coordinate in the geographic data format and call the projection function in turn to calculate the screen coordinates of the latitude and longitude coordinates on the target vector canvas.
[0139] The rendering module 304 is used to generate vector graphic path data based on each screen coordinate and embed the vector graphic path data into the display interface to show the trajectory.
[0140] In one possible implementation, the first processing module 301 is specifically used for:
[0141] Organize latitude and longitude coordinate sequences into linear geometric objects in GeoJSON format;
[0142] Encapsulate geometric objects as collections of features containing geographic feature structures.
[0143] In one possible implementation, the second processing module 302 is specifically used for:
[0144] Iterate through the latitude and longitude coordinates in the geographic data format and determine the minimum longitude value, maximum longitude value, minimum latitude value, and maximum latitude value for each of the latitude and longitude coordinates.
[0145] Generate a bounding box to enclose the entire trajectory based on the minimum longitude value, maximum longitude value, minimum latitude value, and maximum latitude value;
[0146] The actual drawing area is determined based on the width, height, and preset margin parameters of the target vector canvas. The actual drawing area includes the width and height of the actual drawing area.
[0147] Based on the actual drawing area and bounding box, construct a projection function that maps latitude and longitude coordinates to two-dimensional coordinates on a plane.
[0148] In one possible implementation, the second processing module 302 is specifically used for:
[0149] Calculate the first ratio of the actual drawing area width to the longitude span value of the bounding box, and the second ratio of the actual drawing area height to the latitude span value of the bounding box. The longitude span value is the difference between the minimum longitude value and the maximum longitude value, and the latitude span value is the difference between the minimum latitude value and the maximum latitude value.
[0150] Use the minimum of the first ratio and the second ratio as the uniform scaling factor;
[0151] Calculate the horizontal and vertical offsets based on the preset margin parameters, the actual drawing area, the bounding box, and the uniform scaling ratio.
[0152] Based on a uniform scaling factor, horizontal offset, vertical offset, and bounding box, a projection function is constructed to map latitude and longitude coordinates to two-dimensional coordinates on a plane.
[0153] In one possible implementation, the computing module 303 is specifically used for:
[0154] For each latitude and longitude coordinate, calculate the first horizontal coordinate corresponding to the longitude coordinate and the first vertical coordinate corresponding to the latitude coordinate based on a uniform scaling ratio;
[0155] The first horizontal coordinate is offset based on the horizontal offset to obtain the second horizontal coordinate.
[0156] The first vertical coordinate is offset based on the vertical offset to obtain the second vertical coordinate;
[0157] The coordinate axes of the second vertical coordinate are reversed to obtain the third vertical coordinate.
[0158] Use the second horizontal coordinate and the third vertical coordinate as the latitude and longitude coordinates on the target vector canvas as the screen coordinates.
[0159] In one possible implementation, the rendering module 304 is specifically used for:
[0160] Arrange all the screen coordinates obtained from the traversal calculation in the original order of latitude and longitude coordinates to form a screen coordinate sequence;
[0161] Generate a path movement instruction from the first screen coordinate in the screen coordinate sequence, and generate path segment connection instructions for each of the remaining screen coordinates in the screen coordinate sequence in turn.
[0162] By combining path movement instructions and path segment connection instructions, vector graphic path data is generated to describe the trajectory shape.
[0163] Vector graphic path data is embedded into the display interface to show the trajectory.
[0164] In one possible implementation, the vector graphic path data is described in SVG format. The display interface loads the vector graphic path data through SVG path elements and renders the trajectory based on preset trajectory colors, line width parameters, and fill attributes.
[0165] The unmanned vehicle trajectory rendering device provided in this application embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0166] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 4 As shown, the electronic device 40 provided in this embodiment includes at least one processor 401 and a memory 402. Optionally, the device 40 further includes a communication component 403. The processor 401, memory 402, and communication component 403 are connected via a bus 404.
[0167] In a specific implementation, at least one processor 401 executes computer execution instructions stored in memory 402, causing at least one processor 401 to perform the above-described method.
[0168] The specific implementation process of processor 401 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0169] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0170] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0171] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0172] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0173] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0174] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0175] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0176] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0177] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0178] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0179] Based on the above disclosure, those skilled in the art will understand that the computer-readable storage medium and its related implementation methods provided in the embodiments of the present invention are not limited to the specific hardware or logical partitioning forms described above. In actual product or system deployments, computer execution instructions can be encapsulated in different software distribution packages or firmware modules and distributed via networks, optical discs, or mobile storage devices. When computer execution instructions are loaded and executed by one or more processors, in addition to implementing the aforementioned method steps, hardware resource configurations can be automatically identified according to specific application scenarios, and thread priorities or memory allocation strategies can be dynamically adjusted to optimize execution efficiency without manual intervention. Furthermore, the computer-readable storage medium can also be integrated into IoT terminals, edge computing nodes, or cloud servers to form a distributed instruction storage and collaborative execution system to meet differentiated needs such as high concurrency, low latency, or data privacy protection.
[0180] Furthermore, it should be emphasized that the logical functions corresponding to the methods, units, modules, and storage media in this application, without departing from the core idea of this invention, allow developers to make equivalent refactoring, renaming, or re-divisions based on specific programming languages (such as C++, Java, Python, etc.) or framework characteristics. For example, the functions of multiple "units" can be merged into a single service process, or message queues or pipe communication can be used instead of direct function calls. Even if these implementation details are not completely the same as the foregoing embodiments, as long as they ultimately achieve the same technical effect and no creative effort is required, they should all be considered to fall within the protection scope of this invention. Similarly, any intermediate data processing forms, exception handling mechanisms, or logging methods embodied in the instructions in the computer-readable storage medium when executed are also derivative technologies of this invention and should not be construed as substantial limitations on the original solution.
[0181] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0182] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A method for rendering the trajectory of an unmanned vehicle, characterized in that, include: Acquire a continuous sequence of latitude and longitude coordinates collected by an unmanned vehicle, and convert the latitude and longitude coordinate sequence into a standardized geographic data format, wherein the geographic data format contains at least linear elements describing the geometry of the trajectory; The bounding box of the trajectory is calculated based on the geographic data format, and a projection function that maps latitude and longitude coordinates to two-dimensional coordinates on a plane is constructed according to the size parameters of the target vector canvas and the bounding box. Iterate through each of the latitude and longitude coordinates in the geographic data format, and sequentially call the projection function to calculate the screen coordinates of the latitude and longitude coordinates on the target vector canvas; Vector graphic path data is generated based on each screen coordinate, and the vector graphic path data is embedded into the display interface to show the trajectory.
2. The method according to claim 1, characterized in that, The process of converting the latitude and longitude coordinate sequence into a standardized geographic data format includes: The latitude and longitude coordinate sequence is organized into a linear geometric object in GeoJSON format for geographic data exchange. The geometric object is encapsulated as a collection of features containing geographic feature structures.
3. The method according to claim 1, characterized in that, The calculation of the bounding box of the trajectory based on the geographic data format, and the construction of a projection function that maps latitude and longitude coordinates to two-dimensional coordinates on a plane based on the size parameters of the target vector canvas and the bounding box, include: Iterate through the latitude and longitude coordinates in the geographic data format and determine the minimum longitude value, maximum longitude value, minimum latitude value, and maximum latitude value among all latitude and longitude coordinates; A bounding box is generated based on the minimum longitude value, maximum longitude value, minimum latitude value, and maximum latitude value to enclose the entire trajectory; The actual drawing area is determined based on the width, height, and preset margin parameters of the target vector canvas. The actual drawing area includes the width and height of the actual drawing area. Based on the actual drawing area and the bounding box, a projection function is constructed to map latitude and longitude coordinates to two-dimensional coordinates on a plane.
4. The method according to claim 3, characterized in that, The step of constructing a projection function that maps latitude and longitude coordinates to two-dimensional coordinates on a plane based on the actual drawing area and the bounding box includes: Calculate a first ratio of the width of the actual drawing area to the longitude span value of the bounding box, and a second ratio of the height of the actual drawing area to the latitude span value of the bounding box, wherein the longitude span value is the difference between the minimum longitude value and the maximum longitude value, and the latitude span value is the difference between the minimum latitude value and the maximum latitude value; The minimum value between the first ratio and the second ratio is used as the uniform scaling ratio; Calculate the horizontal offset and vertical offset based on the preset margin parameters, the actual drawing area, the bounding box, and the uniform scaling ratio; Based on the uniform scaling ratio, the horizontal offset, the vertical offset, and the bounding box, a projection function is constructed to map latitude and longitude coordinates to two-dimensional coordinates on a plane.
5. The method according to claim 4, characterized in that, The process of traversing each latitude and longitude coordinate in the geographic data format and sequentially calling the projection function to calculate the screen coordinates of the latitude and longitude coordinates on the target vector canvas includes: For each of the latitude and longitude coordinates, the first horizontal coordinate corresponding to the longitude coordinate and the first vertical coordinate corresponding to the latitude coordinate are calculated based on the uniform scaling ratio. The horizontal first coordinate is offset according to the horizontal offset to obtain the horizontal second coordinate; The first longitudinal coordinate is offset according to the longitudinal offset to obtain the second longitudinal coordinate; The vertical second coordinate is reversed to obtain the vertical third coordinate; The second horizontal coordinate and the third vertical coordinate are used as the screen coordinates of the latitude and longitude coordinates on the target vector canvas.
6. The method according to claim 5, characterized in that, The step of generating vector graphic path data based on each screen coordinate and embedding the vector graphic path data into the display interface to display the trajectory includes: Arrange all the screen coordinates obtained from the traversal calculation in the original order of latitude and longitude coordinates to form a screen coordinate sequence; Generate a path movement instruction for the first screen coordinate in the screen coordinate sequence, and generate a path segment connection instruction for each of the remaining screen coordinates in the screen coordinate sequence in sequence. By combining the path movement command and the path segment connection command, vector graphic path data for describing the trajectory shape is generated; The vector graphic path data is embedded into the display interface to show the trajectory.
7. The method according to claim 1, characterized in that, The vector graphic path data is described using the Scalable Vector Graphics (SVG) format. The display interface loads the vector graphic path data through SVG path elements and renders and displays the trajectory based on preset trajectory colors, line width parameters, and fill attributes.
8. An unmanned vehicle trajectory rendering device, characterized in that, include: The first processing module is used to acquire a continuous sequence of latitude and longitude coordinates collected by the unmanned vehicle, and convert the latitude and longitude coordinate sequence into a standardized geographic data format, wherein the geographic data format contains at least linear elements describing the geometry of the trajectory. The second processing module is used to calculate the bounding box of the trajectory based on the geographic data format, and to construct a projection function that maps latitude and longitude coordinates to two-dimensional coordinates on a plane according to the size parameters of the target vector canvas and the bounding box. The calculation module is used to traverse each of the latitude and longitude coordinates in the geographic data format and sequentially call the projection function to calculate the screen coordinates of the latitude and longitude coordinates on the target vector canvas; The rendering module is used to generate vector graphic path data based on each screen coordinate and embed the vector graphic path data into the display interface to display the trajectory.
9. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.