Method and system for superposing map service on three-dimensional model in real time

By obtaining 2D map data on the three-dimensional model and calculating the three-dimensional vertex coordinates, the problem that existing map services cannot display data in a three-dimensional way is solved, and browsing and measuring functions at any angle of view in the 3D map are realized, which improves the user's spatial perception.

CN119478236APending Publication Date: 2025-02-18RUIYU SPACE TIME TECH (CHONGQING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411635253.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The existing map services mainly display data in a 2D plane, and cannot allow users to present map data in three-dimensional effects, resulting in the inability to distinguish hierarchical relationships in space.

Method used

By obtaining 2D map service data, calculating the three-dimensional vertex coordinates, and calling the 3D map rendering engine, real-time overlaying of map services on the three-dimensional model, converting 2D features into 3D features to display in the form of main features.

Benefits of technology

It realizes browsing at any angle in the 3D map, improves user space perception, supports measuring distances in various directions in the map, and performs hierarchical relationship analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119478236A_ABST
    Figure CN119478236A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a system for superposing a map service on a three-dimensional model in real time. The method comprises the following steps: acquiring 2D map service data, acquiring height data of a corresponding terrain according to the 2D map service data, calculating a three-dimensional vertex coordinate, and calling a 3D map rendering engine to obtain a three-dimensional superposed map model. According to the method, browsing can be performed in the 3D map at any view angle, and the perception harvest of the user space is improved; the distance in each direction in a map can be measured, such as the horizontal distance on the ground, the distance perpendicular to the ground or the distance in the direction with a certain included angle with the ground (such as the height of ground features, the length of a pipeline and the like); and carrying out hierarchical relationship analysis on the ground feature elements of the horizontal plane and the vertical plane. According to the method, a technical route of adding 2D map service data to a 3D digital geographic space is adopted, and the design expectation of superposing map service on a three-dimensional model in real time can be realized by rendering common 2D map service data into a 3D map engine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of three-dimensional map model processing, and in particular to a method and system for real-time overlay map service on a three-dimensional model. Background Art

[0002] Map service is a basic data service that provides navigation, positioning, and geographic spatial analysis. At present, most map services, such as Amap, Baidu Map, and Aowei Map, mainly provide 2D plane map services. Among them, the more commonly used data information, such as satellite images, POI points of interest, traffic routes, and land coverage, are all displayed on the plane in 2D. Compared with the daily 3D living space, this always lacks a dimension, so the data that users care about cannot be presented in a three-dimensional effect, so as to facilitate the distinction of spatial hierarchical relationships. Although there are some 3D elements in these common map services, such as buildings and bridges, these 3D elements are mainly used as a background of the map, and only play a visual role in beautifying the 3D background of the map. Moreover, this 3D effect is usually limited by angles, and the map cannot be browsed, measured, calculated, and other operations at any angle. In summary, it can be said that the existing map scheme is mainly based on 2D elements and supplemented by 3D elements.

[0003] Therefore, a method is needed to overlay map services on a three-dimensional model. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a method and system for real-time overlaying map services on a three-dimensional model. The method uses 3D elements as the main elements in the map, and 2D elements are stacked and displayed on the three-dimensional model in the form of map services.

[0005] In order to achieve the above object, the present invention provides the following technical solutions:

[0006] The method for real-time overlaying map services on a three-dimensional model provided by the present invention comprises the following steps:

[0007] Obtain 2D map service data, obtain the height data of the corresponding terrain according to the 2D map service data to calculate the three-dimensional vertex coordinates, and call the 3D map rendering engine according to the three-dimensional vertex coordinates to obtain a three-dimensional overlay map model.

[0008] Furthermore, the 2D map element is 2D vector map service data; height data of terrain corresponding to the 2D vector map service data is obtained; and three-dimensional vertex coordinates are formed according to the coordinate data and height data of the 2D vector map service data.

[0009] Furthermore, the 2D vector map service data includes MVT and WFS.

[0010] Further, the three-dimensional vertex coordinates are calculated according to the 2D vector map service data and the rendering style.

[0011] Furthermore, the element drawing instruction is obtained and a 3D map model is obtained according to the three-dimensional vertex coordinates, and the 3D map model is rendered by a 3D map rendering engine.

[0012] Furthermore, the 2D map service data is raster image data, and the raster image data includes WMS, WMTS, and TMS.

[0013] Furthermore, the raster image data is processed by a texture map update instruction to obtain a three-dimensional map model, and the three-dimensional map model is rendered by a 3D map rendering engine to obtain a three-dimensional overlay map model.

[0014] Furthermore, the 2D vector map service data is superimposed on the 3D model, specifically according to the following steps:

[0015] Through the frame buffer mechanism of the 3D map rendering engine, use the WebGL graphics API to obtain the height data of the terrain;

[0016] Get the coordinates of the current screen;

[0017] Convert the screen coordinates to the NDC coordinate system to obtain the NDC coordinates;

[0018] Calculate the inverse matrix of the projection matrix of the current map engine camera and convert the coordinates in the NDC coordinate system to the world coordinate system according to the following formula:

[0019] x ndc =(2*x screen ) / viewportWidth―1

[0020] y ndc =(2*y screen ) / viewportHeight―1

[0021]

[0022] v world =M*v ndc

[0023] Among them, x ndc Indicates the NDC horizontal coordinate; y ndc Indicates the NDC ordinate; x screen Indicates the horizontal coordinate of the screen; y screen Indicates the screen vertical coordinate;

[0024] viewportWidth indicates the width of the current screen;

[0025] viewportHeight indicates the height of the current screen;

[0026] The obtained real height data Z of each point is added to the X and Y coordinates of each vector element point to form the three-dimensional vertex coordinates, thereby converting the 2D vector element data into 3D vector element data;

[0027] Call the WebGL graphics API, bind the data to the GPU buffer, set the rendering properties and state, finally create the WebGL drawing instructions, and render the vector graphics in the next frame.

[0028] Further, the grid image data is superimposed on the three-dimensional model, specifically according to the following steps:

[0029] Request and download the required raster image data through the Fetch API provided by the browser;

[0030] Call the WebGL graphics API, create a texture object, and associate the texture object with the corresponding model. At the same time, configure the texture parameters or use the default parameters;

[0031] Transfer the raster image data to the GPU;

[0032] Create an update instruction to call the WebGL graphics API, bind the texture object created in the previous step to the model to be rendered, set it to use the first texture unit, and set the location of the sampler uniform variable in the shader code.

[0033] Wait for the rendering engine to execute the rendering process in a loop. When the update instruction is traversed and executed, the goal of updating the texture resource instruction can be achieved. Then, when rendering the next frame, the texture of the corresponding three-dimensional model can be updated.

[0034] The real-time map overlay service system on a three-dimensional model provided by the present invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the above method is implemented when the processor executes the program.

[0035] The beneficial effects of the present invention are:

[0036] The present invention provides a real-time map service method for superimposing a map on a three-dimensional model. The method obtains 2D map service data, obtains the height data of the corresponding terrain according to the 2D map service data, calculates the three-dimensional vertex coordinates, and calls a 3D map rendering engine to obtain a three-dimensional superimposed map model. The method can browse in a 3D map from any perspective, improving the user's spatial perception; it can measure the distance in various directions in the map, such as: horizontal distance on the ground, perpendicular to the ground, or distance at a certain angle to the ground (such as: height of the object, length of the pipeline, etc.); and perform hierarchical relationship analysis of the object elements on the horizontal and vertical planes.

[0037] This method adopts the technical route of adding 2D map service data to 3D digital geographic space. By rendering commonly used 2D map service data into the 3D map engine, it will be able to achieve the design expectation of overlaying map services on the three-dimensional model in real time.

[0038] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to make the purpose, technical solution and beneficial effects of the present invention clearer, the present invention provides the following drawings for illustration:

[0040] Figure 1 A flowchart of a method for overlaying a map service on a three-dimensional model in real time. DETAILED DESCRIPTION

[0041] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.

[0042] like Figure 1 As shown, the method for real-time overlaying map service on a three-dimensional model provided in this embodiment uses 3D elements as the main elements in the map, and 2D elements are stacked and displayed on the three-dimensional model in the form of map service, including the following steps:

[0043] Get the coordinate data of 2D map elements;

[0044] Get the height data of the terrain corresponding to the 2D map element;

[0045] Forming three-dimensional vertex coordinates based on the coordinate data and height data of 2D map elements;

[0046] The three-dimensional vertex coordinates in this embodiment can be extracted by importing the 2D map element data into GIS software, such as ArcGIS, to ensure that the coordinate system of the 2D map element data is consistent with the coordinate system of the elevation model data.

[0047] This embodiment can also calculate the height data of each point of the map element by resampling the DEM data. The resampling tool (Resample) can be used to adjust the resolution of the DEM data. The resampling can be achieved by an interpolation method (such as bilinear interpolation or cubic convolution interpolation) to ensure that the map data is continuous in space.

[0048] This embodiment obtains the three-dimensional vertex coordinates of 2D map elements through the elevation values ​​in the digital elevation model (DEM) data, thereby converting the 2D map into a 3D map.

[0049] Obtain 2D map service data (including MVT and WFS), and calculate 3D vertex coordinates based on the rendering style of the 2D map service data;

[0050] Calling feature drawing instructions according to three-dimensional vertex coordinates, and using a 3D map rendering engine to obtain a three-dimensional overlay map model;

[0051] Get WMS, WMTS, TMS, texture map update instructions, and 3D map rendering engine;

[0052] Among them, MVT (Mapbox Vector Tile) represents the Mapbox vector tile standard, which was first defined and launched by Mapbox and eventually included in the data standard by OGC (Open Geospatial Consortium); WFS (Web Feature Service) represents network feature service; WMS (Web Map Service) represents network map service; WMTS (Web Map Tile Service) represents network map tile service; TMS (Tile Map Service) represents tile map service specification;

[0053] Obtaining three-dimensional map data by creating graphics drawing instructions according to three-dimensional vertex coordinates;

[0054] This embodiment can use vector graphics languages ​​such as SVG (scalable vector graphics) or commands of vector drawing software to create graphics; the three-dimensional map formed by this method can be browsed in the 3D map from any perspective, thereby improving the user's spatial perception; at the same time, the distance in various directions in the map can be measured, such as: horizontal distance on the ground, perpendicular to the ground, or distance at a certain angle to the ground (such as: height of the object, length of the pipeline, etc.); hierarchical relationship analysis of the object elements in the horizontal and vertical planes can be performed.

[0055] This method provides a method for overlaying map services on a three-dimensional model in real time, adding 2D map service data (the map service data here mainly refers to WMS, WMTS, WFS, MVT proposed by the OGC organization, and TMS services proposed by the OSGeo organization) to the 3D digital geographic space.

[0056] Usually the final rendering result displayed on the screen is obtained by fusion and stacking of multiple frames.

[0057] The 2D map elements of this embodiment include two types: 2D vector map service data and raster image data:

[0058] (1) 2D vector map service data. Since vector features usually only carry 2D coordinate data, it is necessary to calculate their height data Z and convert them into 3D coordinates for rendering in three-dimensional space.

[0059] First, traverse the coordinates of these 2D vector data points (denoted as v 2d =(x 2d ,y 2d )), and convert it into screen coordinates v according to formula (1) screen =(x screen ,y screen ), here you need to first change v 2d The vector is converted from a 2x1 vector to a 4x1 vector. Here, we use the property that multiplying 0 by any number still results in 0, which is v 2d The vector is assigned a z component and a w component, and the values ​​of these two components are kept at 0, that is: let v 2d =(x 2d ,y 2d , 0, 0); then:

[0060] Among them, M mvp Represents the MVP matrix of the current map rendering engine, which is usually obtained from the API of the map rendering engine; T represents the mathematical operation symbol for transposing the vector;

[0061] Then, through the frame buffer of the 3D map rendering engine (which is provided by the browser's WebGL graphics API) mechanism, through the WebGL graphics API (usually glReadPixels), read the data in the depth buffer (the depth value here should be a linear depth value) and map it to [-1,1] to obtain the mapping data z of the height data of the 3D model surface depth ;

[0062] Then, the width and height of the current screen visible area can be obtained through the WebGL graphics API. Assume that the width and height values ​​are: viewportWidth and viewportHeight respectively. First, according to formula (2), the vertex coordinates (x screen ,y screen ,z depth ) is converted to the NDC coordinate system (normalized device coordinate system, usually the three axes xyz are between [-1,1]) to obtain the NDC coordinate (x ndc ,y ndc ),

[0063] Then, calculate the inverse matrix of the projection matrix of the current map engine camera (M, which is a 4x4 matrix), and convert the coordinates in the NDC coordinate system to the world coordinate system according to the following formula:

[0064] x ndc =(2*x screen ) / viewportWidth―1

[0065] y ndc =(2*y screen ) / viewportHeight―1 (2)

[0066] z ndc =2*z depth -1

[0067]

[0068] v world =M*v ndc

[0069] Among them, x ndc Indicates the NDC horizontal coordinate; y ndc Indicates the NDC ordinate; z ndc Indicates the coordinate of NDC vertical to the screen direction; x screen Indicates the horizontal coordinate of the screen; y screen Indicates the screen vertical coordinate; viewportWidth indicates the width of the current screen; viwportHeight indicates the height of the current screen; v ndcRepresents the vertex coordinates in the NDC coordinate system; v world Represents the vertex coordinates in the world coordinate system; M represents the inverse matrix of the projection matrix of the map engine camera; T represents the transposition operation of the current matrix;

[0070] At this point, the true height data Z of each point is obtained, which corresponds to v world The Z component data (Z = z world ), it is necessary to further append the Z coordinate after the X and Y coordinates of the vector feature point to convert the 2D vector feature data into 3D vector feature data; then, call the WebGL graphics API, bind the data to the GPU buffer, set the rendering properties and status, and finally create a WebGL drawing instruction, and render the vector graphic in the next frame.

[0071] (2) Raster image data, since it is already image data, it only needs to be used as a texture image of a three-dimensional model. Before rendering the next frame, a texture resource update instruction that conforms to the current 3D map rendering engine is constructed. The existing method can be used to construct a three-dimensional texture model through the texture resource update instruction. The specific process is as follows:

[0072] First, you need to request and download the required raster image data through the Fetch API provided by the browser in the engine; then, call the WebGL graphics API, create a texture object, and associate the texture object with the corresponding model. At the same time, you need to configure the texture parameters or use the default parameters; then, transfer the raster image data, that is, the texture data, to the GPU; finally, create an update instruction, that is, call the WebGL graphics API, bind the texture object created in the previous step to the model to be rendered, set the first texture unit to use, and set the position of the sampler uniform variable in the shader code.

[0073] Through the above steps, the rendering engine is waited for to execute the rendering process in a loop. When the update instruction is traversed and executed, the goal of updating the texture resource instruction can be achieved. Then, when rendering the next frame, the texture of the corresponding three-dimensional model can be updated.

[0074] The raster graphics themselves are pasted onto the 3D model as texture images. When rendering, these 2D raster graphics can be pasted onto the model according to the texture coordinates of the model.

[0075] When the map perspective is updated, the process in the above diagram will be repeated, and so on. By rendering the commonly used 2D map service data into the 3D map engine, the design expectation of overlaying the map service on the three-dimensional model in real time will be realized.

[0076] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.

Claims

1. A method for real-time overlaying a map service on a three-dimensional model, characterized in that: The following steps are involved: Obtain 2D map service data, obtain the height data of the corresponding terrain according to the 2D map service data to calculate the three-dimensional vertex coordinates, and call the 3D map rendering engine according to the three-dimensional vertex coordinates to obtain a three-dimensional overlay map model.

2. The method for providing a real-time map overlay service on a three-dimensional model as claimed in claim 1, characterized in that: The 2D map element is 2D vector map service data; the height data of the terrain corresponding to the 2D vector map service data is obtained; and the three-dimensional vertex coordinates are formed according to the coordinate data and the height data of the 2D vector map service data.

3. The method for providing a real-time map overlay service on a three-dimensional model as claimed in claim 2, characterized in that: The 2D vector map service data includes MVT and WFS.

4. The method for real-time overlaying map service on a three-dimensional model as claimed in claim 2, characterized in that: Calculates 3D vertex coordinates based on 2D vector map service data and rendering style.

5. The method for real-time overlaying map service on a three-dimensional model as claimed in claim 4, characterized in that: Obtain feature drawing instructions and draw a 3D map model according to the three-dimensional vertex coordinates, and render the 3D map model through a 3D map rendering engine.

6. The method for real-time overlaying map service on a three-dimensional model as claimed in claim 4, characterized in that: The 2D map service data is raster image data, and the raster image data includes WMS, WMTS, and TMS.

7. The method for providing a real-time map overlay service on a three-dimensional model as claimed in claim 6, characterized in that: The raster image data is processed by a texture map update instruction to obtain a three-dimensional map model, and the three-dimensional map model is rendered by a 3D map rendering engine to obtain a three-dimensional overlay map model.

8. The method for real-time overlaying map services on a three-dimensional model as claimed in claim 2, characterized in that: The 2D vector map service data is superimposed on the 3D model, specifically according to the following steps: Through the frame buffer mechanism of the 3D map rendering engine, use the WebGL graphics API to obtain the height data of the terrain; Get the coordinates of the current screen; Convert the screen coordinates to the NDC coordinate system to obtain the NDC coordinates; Calculate the inverse matrix of the projection matrix of the current map engine camera and convert the coordinates in the NDC coordinate system to the world coordinate system according to the following formula: x ndc =(2*x screen ) / viewportWidth-1 and ndc (2*y) screen ) / viewportHeight-1 in world =M*v ndc Among them, x ndc Indicates the NDC horizontal coordinate; y ndc Indicates the NDC ordinate; x screen Indicates the horizontal coordinate of the screen; y screen Indicates the screen vertical coordinate; viewportWidth indicates the width of the current screen; viewportHeight indicates the height of the current screen; The obtained real height data Z of each point is added to the X and Y coordinates of each vector element point to form the three-dimensional vertex coordinates, thereby converting the 2D vector element data into 3D vector element data; Call the WebGL graphics API, bind the data to the GPU buffer, set the rendering properties and state, finally create the WebGL drawing instructions, and render the vector graphics in the next frame.

9. The method for real-time overlaying map service on a three-dimensional model as claimed in claim 6, characterized in that: The grid image data is superimposed on the three-dimensional model, specifically according to the following steps: Request and download the required raster image data through the Fetch API provided by the browser; Call the WebGL graphics API, create a texture object, and associate the texture object with the corresponding model. At the same time, configure the texture parameters or use the default parameters; Transfer the raster image data to the GPU; Create an update instruction, call the WebGL graphics API, bind the texture object created in the previous step to the model to be rendered, set it to use the first texture unit, and set the location of the sampler uniform variable in the shader code; Wait for the rendering engine to execute the rendering process in a loop. When the update instruction is traversed and executed, the goal of updating the texture resource instruction can be achieved. Then, when rendering the next frame, the texture of the corresponding three-dimensional model can be updated.

10. A real-time map overlay service system on a three-dimensional model, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 9 is implemented.