Efficient and large-scale method for converting two-dimensional coordinate system into three-dimensional coordinate system for digital twinning software
By combining Mean Shift grouping and the GDAL algorithm with AABB bounding boxes and raster sampling detection, an efficient and accurate conversion from two-dimensional projected coordinates to three-dimensional Cartesian coordinates is achieved. This solves the problems of computational complexity and resource waste in existing technologies, and improves the processing efficiency and data accuracy of digital twin software.
Patent Information
- Application Number
- CN202410943607.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-14
- Publication Date
- 2024-11-15
AI Technical Summary
Existing technologies for converting 2D projected coordinates to 3D Cartesian coordinates in digital twin 3D software are computationally complex and time-consuming, leading to resource waste and model distortion, which affects data accuracy and user experience.
The Mean Shift grouping algorithm is used to group data, the centroid is selected as the reference point, the GDAL algorithm library is used for accurate coordinate conversion, and the AABB bounding box and raster sampling detection algorithm are used for approximate conversion and accuracy verification to achieve fast and accurate batch conversion.
It improves the efficiency of large-scale data processing, avoids resource waste and model distortion, ensures data accuracy and stability, and enhances user experience.
Smart Images

Figure CN118967801A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of coordinate data processing technology, and in particular to a method for efficiently converting large quantities of two-dimensional coordinates into a three-dimensional coordinate system for digital twin software. Background Art
[0002] In digital twin 3D software, it is often necessary to convert the projection coordinates of the model or layer into a 3D Cartesian rectangular coordinate system for use. First of all, the projection coordinate system is a plane coordinate system projected from the geographic ellipsoid in a geographic information system, and often has coordinate conversion parameters specific to the region. The 3D Cartesian coordinate system is a more general right-hand rectangular system without the characteristics of the ellipsoid. The conversion between the two requires more complicated calculation steps.
[0003] In the digital twin 3D software industry, the current mainstream practice is to use the GDAL algorithm library to convert coordinate systems. However, coordinate system conversion requires a lot of complex calculations and is time-consuming. Especially when the coordinates of a large number of objects need to be calculated in batches, the reading and writing speed of large files and the time consumption of network requests are multiplied, and each point is processed separately, which easily leads to waste of computing resources and reduced processing speed, and may cause system freezes. In addition, when processing 3D model point data with projection coordinates, the independent processing of each point may cause model distortion, affecting the accuracy and completeness of the data. These will bring a poor user experience to the digital twin software.
[0004] To this end, we propose a method for batch conversion from a two-dimensional projection coordinate system to a three-dimensional Cartesian coordinate system, so as to efficiently and quickly perform coordinate conversion of large-scale models or layer data and ensure a certain data accuracy, which plays an important role in saving loading time, saving network resources, and saving software computing resources. Summary of the invention
[0005] The purpose of the present invention is to provide an efficient and large-scale two-dimensional coordinate conversion method to a three-dimensional coordinate system for digital twin software, so as to solve the problems raised in the above-mentioned background technology.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] An efficient and large-scale method for converting two-dimensional coordinates into three-dimensional coordinate systems for digital twin software includes the following steps:
[0008] Step 1: Use Mean Shift grouping algorithm to group the data and find the centroid of each group;
[0009] Step 2: Select the centroid of each group as the base point, and perform coordinate transformation on the centroid;
[0010] Step 3: Use the GDAL algorithm library to perform precise coordinate conversion to obtain the accurate reference point position;
[0011] Step 4: Calculate the AABB bounding box for other coordinate objects in the group to achieve rapid recognition of approximate coordinate transformation;
[0012] Step 5: Use the grid sampling detection algorithm to check the coordinate accuracy and evaluate the conversion accuracy.
[0013] As a further solution of the present invention: the step 1 comprises the following steps:
[0014] a1: randomly select a point from the data as the initial point C, and define the moving window radius r as a parameter;
[0015] a2: For each data point, calculate its distance to the initial point C as the parameter distance;
[0016] a3: Calculate the weight of each point in the window with radius r and the initial point C as the center, and determine the weight according to the distance between the data point and C;
[0017] a4: Adjust the position of the initial point C according to the weight, so that the initial point C moves to the area with higher density, and update the position of the initial point C to the weighted average value;
[0018] a5: Repeat steps a2 and a3 until the initial point C stops moving or reaches a certain number of iterations;
[0019] a6: Centroid identification: Apply the Mean Shift algorithm to the coordinate data grouping to find the centroid of each group.
[0020] As a further solution of the present invention: Step three includes: using the GDAL algorithm library to accurately convert the coordinates of each selected reference point BasePoint to obtain the accurate reference point position BasePointLocation = GDAL.Project(BasePoint), wherein BasePointLocation is a parameter, and the reference point coordinate value is converted from (B, L, H) to (x, y, h).
[0021] As a further solution of the present invention: the step 4 comprises the following steps:
[0022] b1: Traverse the coordinate set: traverse the coordinate set outside the reference point in the group one by one, obtain the original coordinate data and corresponding transformation matrix of the current object for each coordinate object, and determine the range of objects that need to be transformed;
[0023] b2: Calculate new AABB packaging box: For each coordinate group object, calculate the new AABB packaging box based on its original AABB packaging box and transformation matrix to achieve fast recognition of approximate coordinate transformation and determine the minimum and maximum vertex coordinates of the new bounding box for subsequent use;
[0024] b3: Perform approximate coordinate transformation: for each object, obtain its original coordinate data and the corresponding transformation matrix;
[0025] Convert the original coordinate data into homogeneous coordinate representation;
[0026] Multiply the transformation matrix by the homogeneous coordinates to obtain new approximate coordinate data;
[0027] Convert the new approximate coordinate data back into Cartesian coordinate representation;
[0028] Updates the object's coordinate data, replacing it with new approximate coordinate data.
[0029] As a further solution of the present invention: the step five comprises:
[0030] c1: Grid division: divide the new dataset after coordinate transformation into uniform grids, each grid contains multiple transformed coordinate points;
[0031] c2: Select a random sampling point in each grid and extract its converted coordinate position;
[0032] c3: Perform precise coordinate conversion of each sampling point value and its corresponding original projection coordinate value using the GDAL algorithm library, calculate the error value, and use the Euclidean distance for measurement;
[0033] c4: Perform statistical analysis on the errors of all sampling points, calculate indicators such as average error and standard deviation, and evaluate the accuracy of coordinate transformation.
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] 1. The present invention can quickly process large-scale data and ensure a certain data accuracy. At the same time, for three-dimensional model points with projection coordinates, it can avoid large distortion and maintain data accuracy. By optimizing the processing method, this solution improves processing efficiency while ensuring data accuracy, avoids resource waste and model distortion problems in traditional solutions, and brings a more efficient and accurate solution to the field of coordinate transformation.
[0036] 2. The present invention provides an idea of using precise transformation of grouped reference points + approximate transformation within the group, which realizes the process of converting two-dimensional projection coordinates to three-dimensional rectangular coordinate systems, and can batch process large quantities of coordinate points; using parallel computing and bounding box operations, efficient conversion of coordinate data is achieved. This algorithm idea can not only ensure the accuracy and stability of the conversion, but also significantly improve the processing efficiency, and is suitable for scenarios that require large-scale processing of coordinate data.
[0037] 3. The present invention introduces the application of Mean Shift grouping algorithm in coordinate data processing. By grouping and clustering the coordinate data, the identification and organization of the correlation between data points are realized. Through the clustering process of Mean Shift algorithm, the groups of data points can be divided more accurately, providing effective data preparation for subsequent coordinate conversion and processing.
[0038] 4. The present invention realizes fast approximate conversion of coordinate data by calculating new AABB packaging boxes and applying transformation matrices. During the approximate conversion process, a step of precision verification based on grid sampling is introduced to ensure the accuracy and stability of the conversion results, thereby improving the reliability of the overall processing flow. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A schematic diagram of the geographic coordinate system.
[0040] Figure 2 Schematic diagram of Cartesian three-dimensional rectangular system. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0042] The following is an explanation of the professional terms involved in the present invention:
[0043] 1. Digital twin software: It is a technology platform based on three-dimensional virtual space, using digital three-dimensional models, shape simulation technology, Internet of Things and other technologies to achieve mutual mapping, interaction and collaboration between the physical world and the digital world. In digital twin software, users can simulate complex systems in the real world for design, analysis, optimization and decision-making.
[0044] 2. Geographic ellipsoid: The geographic ellipsoid is a mathematical model that approximates the shape of the earth. It uses five parameters: major semi-axis a, minor semi-axis b, flattening α, first eccentricity e, and second eccentricity e' to describe the shape of the earth's ellipsoid. Various geographic coordinate systems are defined based on certain geographic ellipsoid models to meet the requirements of different countries, regions, and uses. For example, the WGS84 ellipsoid and the CGCS2000 ellipsoid are both derived from the 1980 Geodetic Reference System GRS80 ellipsoid, and both have been slightly improved. The two ellipsoids based on these two geographic coordinate systems have only a slight difference in flattening.
[0045] 3. Projected coordinate system: A coordinate system commonly used in geographic information systems, which is projected from the geographic ellipsoid and is used to represent the position of the earth's surface on a plane. Different regions usually use different projected coordinate systems, accompanied by specific coordinate conversion parameters to ensure the accuracy and consistency of the coordinates.
[0046] 4. Geographic coordinate system: The geographic coordinate system is also based on the geographic ellipsoid, but it is a three-dimensional coordinate system that has not been projected on a plane and is usually expressed in longitude and latitude. This ellipsoid-based geographic coordinate system is widely used in GIS software. Different geographic ellipsoids result in different geographic coordinate systems. In cartography and geographic information systems, geographic coordinate systems are often used in combination with projection coordinate systems to facilitate data conversion and visualization between different map projections and coordinate systems. Figure 1 As shown, a point on the earth is determined by three parameters: latitude B (elevation distance relative to the equator, in degrees), longitude L (azimuth relative to the prime meridian Greenwich line, in degrees), and altitude H (height relative to the reference ellipsoid, in meters).
[0047] 5. Cartesian 3D rectangular system: It is a commonly used 3D coordinate system representation method, which is widely used in digital twin software, 3D modeling software, etc. The position of any point in space is described by the X, Y, and Z axes of the rectangular coordinate system. This more general expression method is conducive to geometric calculation and analysis of 3D space. Figure 2 As shown, a point on the Earth is determined by three parameters: the x-value (the X-axis points to the equator / prime meridian Greenwich intersection), the y-value (the Y-axis is orthogonal to the X and Z-axes), and the h-value (the Z-axis is aligned with the Earth's rotation axis).
[0048] 6. Coordinate conversion: Since the coordinate standards in different places are not completely consistent and the coordinate data standards provided by various systems are not unified, the process of converting coordinate data in different coordinate systems is one of the key contents that various 3D software need to study. In this patent, the focus is on the conversion between the plane projection coordinate system and the Cartesian rectangular coordinate system. An effective coordinate conversion algorithm can realize the interoperability between different coordinate systems and provide basic support for the processing and analysis of spatial data.
[0050] The present invention provides a large-scale conversion algorithm for two-dimensional projection coordinates to a three-dimensional coordinate system. The MeanShift grouping algorithm is used to group data and find the centroid of each group, and the centroid is selected as the reference point for coordinate conversion processing. Then, the GDAL algorithm library is used to perform precise coordinate conversion to obtain the accurate reference point position. Next, the AABB bounding box is calculated for other coordinate objects in the group to achieve rapid identification of approximate coordinate conversion. Finally, the coordinate accuracy is checked by the grid sampling detection algorithm to evaluate the conversion accuracy. Its advantage is that it combines the principles of the Mean Shift algorithm and the bounding box to achieve fast and accurate coordinate conversion, while improving the accuracy of the conversion through grid sampling inspection.
[0051] Specific:
[0052] 1. Mean Shift grouping algorithm initialization:
[0053] (1) Randomly select a point from the data as the initial point C and define the moving window radius r as a parameter.
[0054] (2) For each data point, calculate its distance to the initial point C as the parameter distance.
[0055] (3) Calculate the weight of each point in the window with radius r and center C, and determine the weight based on the distance between the point and C.
[0056] (4) Adjust the position of C according to the weight so that C moves to the area with higher density. Update the position of C to the weighted average.
[0057] (5) Repeat steps (2) and (3) until C stops moving or reaches a certain number of iterations.
[0058] 2. Projection coordinate grouping algorithm processing:
[0059] (1) Centroid identification: Apply the Mean Shift algorithm to the coordinate data grouping to find the centroid of each group.
[0060] (2) Base point processing: Perform coordinate transformation on each centroid and select the centroid as the base point.
[0061] 3. Algorithm library conversion based on benchmark points:
[0062] (1) Use the GDAL algorithm library to perform precise coordinate conversion for each selected reference point to obtain the accurate reference point location BasePointLocation = GDAL.Project(BasePoint), where BasePointLocation is a parameter. The reference point coordinate value is converted from (B, L, H) to (x, y, h).
[0063] 4. Batch approximate conversion of other coordinates in the group:
[0064] (1) Traversing the coordinate set: Traverse the coordinate set outside the reference point in the group one by one, obtain the original coordinate data of the current object and the corresponding transformation matrix for each coordinate object, and determine the range of objects that need to be transformed.
[0065] (2) Calculate a new AABB box: For each coordinate group object, calculate a new AABB box based on its original AABB box and transformation matrix to achieve rapid recognition of approximate coordinate transformations. Determine the minimum and maximum vertex coordinates of the new bounding box for subsequent use.
[0066] (3) Perform approximate coordinate transformation:
[0067] For each object, obtain its original coordinate data and the corresponding transformation matrix. Convert the original coordinate data into homogeneous coordinate representation. Multiply the homogeneous coordinates by the transformation matrix to obtain new approximate coordinate data. Convert the new approximate coordinate data back into Cartesian coordinate representation. Update the coordinate data of the object and replace it with the new approximate coordinate data.
[0068] 5. Grid sampling detection algorithm coordinate accuracy test:
[0069] (1) Grid division: The new dataset after coordinate transformation is divided into uniform grids, each grid containing multiple transformed coordinate points.
[0070] (2) Select sampling values: Select a random sampling point in each grid and extract its converted coordinate position.
[0071] (3) Calculate the error: Perform precise coordinate conversion of each sampling point value and its corresponding original projection coordinate value using the GDAL algorithm library, calculate the error value, and use the Euclidean distance for measurement.
[0072] / / Latitude and longitude deviation
[0073] Offset=Point-BasePoint
[0074] / / Actual distance difference in latitude
[0075] LatitudeOffset=Pi x EARTH_Radius x Offset.Latitude / 180.0;
[0076] LongitudeOffset=Pi x EARTH_Radius x(cos(Point.Latitude)x EARTH_Radius)x Offset.Longitude / 180.0;
[0077] PointLocation=BasePointLocation+Vector(LongitudeOffset,LatitudeOffset);
[0078] (4) Statistical analysis: Statistical analysis is performed on the errors of all sampling points, and indicators such as the average error and standard deviation are calculated to evaluate the accuracy of the coordinate transformation.
[0079] The main algorithm code and comments of this rotation method are provided below:
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086] Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments, or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An efficient and large-scale two-dimensional coordinate conversion method to a three-dimensional coordinate system for digital twin software, characterized in that: The following steps are involved: Step 1: Use Mean Shift grouping algorithm to group the data and find the centroid of each group; Step 2: Select the centroid of each group as the base point, and perform coordinate transformation on the centroid; Step 3: Use the GDAL algorithm library to perform precise coordinate conversion to obtain the accurate reference point position; Step 4: Calculate the AABB bounding box for other coordinate objects in the group to achieve rapid recognition and conversion of approximate coordinates; Step 5: Use the grid sampling detection algorithm to check the coordinate accuracy and evaluate the conversion accuracy; In step 4, the conversion steps of approximate coordinates are: s1: For each object, obtain its original coordinate data and corresponding transformation matrix; s2: Convert the original coordinate data into homogeneous coordinate representation; s3: Multiply the transformation matrix by the homogeneous coordinates to obtain new approximate coordinate data; s4: convert the new approximate coordinate data back into Cartesian coordinate representation; s5: Update the coordinate data of the object and replace it with the new approximate coordinate data.
2. According to claim 1, a high-efficiency and large-scale two-dimensional coordinate conversion method for digital twin software to a three-dimensional coordinate system is characterized in that: The step 1 comprises the following steps: a1: randomly select a point from the data as the initial point C, and define the moving window radius r as a parameter; a2: For each data point, calculate its distance to the initial point C as the parameter distance; a3: Calculate the weight of each point in the window with radius r and the initial point C as the center, and determine the weight according to the distance between the data point and C; a4: Adjust the position of the initial point C according to the weight, so that the initial point C moves to the area with higher density, and update the position of the initial point C to the weighted average value; a5: Repeat steps a2 and a3 until the initial point C stops moving or reaches a certain number of iterations; a6: Centroid identification: Apply the Mean Shift algorithm to the coordinate data grouping to find the centroid of each group.
3. According to claim 1, a high-efficiency and large-scale two-dimensional coordinate conversion method for digital twin software to a three-dimensional coordinate system is characterized in that: The step three includes: using the GDAL algorithm library to accurately convert the coordinates of each selected reference point BasePoint to obtain an accurate reference point location BasePointLocation=GDAL.Project(BasePoint), wherein BasePointLocation is a parameter, and the reference point coordinate value is converted from (B, L, H) to (x, y, h).
4. The method for converting two-dimensional coordinates into three-dimensional coordinates in high-efficiency and high-volume manner for digital twin software according to claim 1, characterized in that: The step 4 further includes the following steps before performing the approximate coordinate conversion: b1: Traverse the coordinate set: traverse the coordinate set outside the reference point in the group one by one, obtain the original coordinate data and corresponding transformation matrix of the current object for each coordinate object, and determine the range of objects that need to be transformed; b2: Calculate new AABB box: For each coordinate group object, calculate a new AABB box based on its original AABB box and transformation matrix to achieve fast recognition of approximate coordinate transformations and determine the minimum and maximum vertex coordinates of the new bounding box for subsequent use.
5. The method for converting two-dimensional coordinates into three-dimensional coordinates in high-efficiency and high-volume manner for digital twin software according to claim 1, characterized in that: The step five comprises: c1: Grid division: divide the new dataset after coordinate transformation into uniform grids, each grid contains multiple transformed coordinate points; c2: Select a random sampling point in each grid and extract its converted coordinate position; c3: Perform precise coordinate conversion of each sampling point value and its corresponding original projection coordinate value using the GDAL algorithm library, calculate the error value, and use the Euclidean distance for measurement; c4: Perform statistical analysis on the errors of all sampling points, calculate indicators such as average error and standard deviation, and evaluate the accuracy of coordinate transformation.
