Method and device for releasing shaded share map tiles in real time
Through real-time computing and tile caching mechanisms, the problem of solidifying the traditional halo rendering effect is solved, and the real-time release of halo rendering tiles at any lighting angle is realized without pre-stored data, improving service performance and efficiency.
Patent Information
- Application Number
- CN202410963099.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-12-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional halo rendering release requires setting the sun's direction angle and height angle in advance to generate fixed halo rendering data, which cannot be changed in real time, resulting in solidification of the effect and taking up a large storage space.
Receive real-time requests through the server, access the tile cache pool to find matching slope-oriented cache tiles. If not, calculate slope and slope-oriented tiles from the digital elevation model data, and calculate in real time based on the solar altitude angle and azimuth angle. Halo rendering tile data, released in real time.
It realizes the real-time calculation of halo rendering tiles of any lighting angle without pre-storing physical halo rendering data, improving service performance and efficiency, and solving the problem of effect solidification.
Smart Images

Figure CN119068129A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of geographic information technology, and in particular to a method and device for publishing shaded image tiles in real time. Background Art
[0002] The shading map can help users understand the terrain change characteristics more intuitively than the elevation data itself. Under certain application conditions, for example, terrain-based applications, it is necessary to overlay the shading map data to enhance the visual effect. Therefore, the shading map data needs to be published using the Web Map Tile Service (WMTS).
[0003] To publish traditional shading maps, you first need to use professional software such as ArcGIS to calculate the light and shadow of the digital elevation model (DEM), generate shading map data and store it in the machine, and then use professional geographic information system (GIS) software such as GeoServer to match colors and publish it. When making shading maps, you need to set the direction angle and altitude angle of the sun in advance, generate shading maps and pre-store them in the system, and they cannot be changed later. If you need shading map effects at different times, that is, at different sun angles, you need to make multiple copies of data and pre-store them in the system. Making shading maps in this way not only takes up a lot of storage space, but also the generated shading maps cannot be changed, and the effect is solidified.
[0004] Therefore, it is urgent for the industry to provide a solution that can calculate the shading map tile data of any lighting angle in real time to publish the shading map tiles in real time and solve the existing problem of solidification of shading map effects. Summary of the invention
[0005] In view of this, one or more embodiments of the present specification describe a method and apparatus for publishing shading image tiles in real time to eliminate or improve one or more defects existing in the prior art.
[0006] According to a first aspect, a method for publishing a shading image tile in real time is provided, the method being executed by a server and comprising:
[0007] Receive a real-time request for a shaded image tile, the real-time request including a layer, a level, a row number, a column number, a solar altitude angle, and a solar azimuth angle;
[0008] In response to the real-time request, access the tile cache pool to find a matching slope and direction cache tile;
[0009] When the slope and aspect cache tile search is successful, obtaining the slope tile data and the aspect tile data from the slope and aspect cache tile;
[0010] In the case where the slope and aspect cache tile search fails, the corresponding DEM tile is obtained from the digital elevation model DEM data, and the slope tile data and the aspect tile data are calculated based on the obtained DEM tile;
[0011] Calculating the shading image tile data in real time based on the slope tile data, the aspect tile data, the sun altitude angle, and the sun azimuth angle;
[0012] Based on the shading image tile data calculated in real time, the shading image tile is published in real time.
[0013] In some embodiments, after calculating the slope tile data and the aspect tile data, the method further includes: adding tiles for which the slope tile data and the aspect tile data have been calculated to the tile cache pool to generate slope and aspect cache tiles.
[0014] In some embodiments, after generating a slope direction cache tile, it further includes: setting a priority for the slope direction cache tile, the initial value of the priority being an initial priority; when the slope direction cache tile is accessed once, the priority is increased by a predetermined increment; if it is not accessed after a time threshold, the priority is reduced by a predetermined decrement; when the tile cache pool is full, the slope direction cache tile with a low priority is eliminated.
[0015] In some embodiments, the corresponding DEM tile is obtained from the digital elevation model DEM data by expanding a pixel range.
[0016] In some embodiments, the real-time request includes a color scheme; and the real-time publishing of the shaded image tile further includes: performing color mapping on the shaded image tile based on the color scheme to generate an output tile.
[0017] According to a second aspect, a device for publishing shading tiles in real time is provided, comprising a processor and a memory, wherein the memory stores computer instructions, and the processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the device implements the steps of the method described in the first aspect.
[0018] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0019] According to a fourth aspect, a computer program product is provided, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method as described in the first aspect.
[0020] The method and device for real-time publishing of shading map tiles provided in the embodiments of this specification do not require the physical storage data of the actual shading map. The relevant local content can be directly obtained through the original DEM, and the shading map of any lighting angle can be calculated in real time to obtain the corresponding tile data and publish it externally. At the same time, the service performance can be improved through the tile caching mechanism.
[0021] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention may be achieved and obtained by the structures specifically indicated in the specification and the accompanying drawings.
[0022] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of the present application, and do not constitute a limitation of the present invention. In the drawings:
[0024] Figure 1 shows a schematic diagram of the DEM described in this specification;
[0025] Figure 2 shows a schematic diagram of a shading diagram described in this specification;
[0026] Figure 3 A schematic diagram of an implementation scenario of an embodiment disclosed in this specification is shown;
[0027] Figure 4 A flow chart showing a method for publishing shading image tiles in real time according to one embodiment is shown;
[0028] Figure 5 An example location image tile is shown;
[0029] Figures 6 to 10 Various schematic diagrams generated when the present invention is used to publish shading image tiles are shown. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0031] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.
[0032] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.
[0033] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
[0034] First, the technical terms involved in this application are explained.
[0035] Digital Elevation Model (DEM): A type of raster data in which the value of each grid cell is the elevation information of the geographical location represented by the grid cell. Figure 1 shown.
[0036] Shaded map: A form of DEM surface morphology expression, which displays the terrain of a region in a more vivid or more human-vision-friendly way by setting the altitude and azimuth of the light source, such as Figure 2 As shown in the figure, the shading map can well reflect the changes in terrain and has a good three-dimensional sense, which is convenient for map users.
[0037] Web Map Tile Service (WMTS): A tile map service standard developed by Occupationally-generated Content (OGC). Map services published in accordance with the standard can be directly loaded and used by all software that supports this standard.
[0038] GetTile: WMTS service tile acquisition interface, specify the layer, level, row number and column number, and obtain the tile map in the specified format.
[0039] Next, if Figure 3As shown, a schematic diagram of an implementation scenario of an embodiment disclosed in this specification is shown. In this implementation scenario, a user inputs a real-time request for a shading image tile through a terminal 02, and a server 01 receives the real-time request from the terminal 02 for processing and publishes the shading image tile in real time, that is, sends the shading image tile to the terminal 02 in real time, and the user views and uses the shading image through the terminal 02.
[0040] The server 01 may be a server, a desktop computer or a tablet computer, and is connected to the terminal via a broadband network.
[0041] Terminal 02 may specifically be, but is not limited to, a mobile phone, a tablet computer, a laptop computer, a wearable device (such as a smart watch, a smart bracelet, a smart helmet, smart glasses, etc.), and other devices with image display capabilities and input and output functions.
[0042] The following describes the specific implementation process of publishing shading tiles in real time.
[0043] Figure 4 A flowchart of a method for publishing a gradient image tile in real time according to an embodiment is shown. The method is executed by any device, equipment, or system with computing and processing capabilities. In one embodiment, the execution subject of the method may be a server. Figure 4 As shown, the method may include the following steps:
[0044] Step S401, receiving a real-time request for a shaded image tile. In one embodiment, the real-time request includes a layer, a level, a row number, a column number, a solar altitude angle, and a solar azimuth. For example, using the WMTS service, taking the northwest direction as an example, the solar azimuth parameter is azimuth=315, and the solar altitude parameter is elevation=45. The complete request example is as follows:
[0045] http: / / localhost:5666 / dem_server? request=GetTile&service=wmts&layer=xxx&Format=jpeg&TileMatrixSet=l&TileMatrix=9&TileCol=845&TileRow=143&azimuth=315&evalation=45.
[0046] Obviously, the live request can also include other parameters, such as a color scheme. When the color scheme is included, the complete request example above changes to:
[0047] http: / / localhost:5666 / dem_server? request=GetTile&service=wmts&layer=xxx&Format=jpeg&TileMatrixSet=l&TileMatrix=9&TileCol=845&TileRow=143&azimuth=315&evaluation=45&color_scheme=default.
[0048] In step S403, the server accesses the tile cache pool for the received real-time request and searches for matching slope and direction cache tiles. It should be understood that the tile cache pool caches the slope and direction cache tiles with slope tile data and direction tile data, so that when the server receives the tile request service issued by the terminal, it determines whether the search is successful in step S405. If the matching slope and direction cache tiles are successfully found in the tile cache pool, the slope tile data and the direction tile data can be directly obtained from the slope and direction cache tiles, as shown in step S407. By caching the slope and direction cache tiles with slope tile data and direction tile data in the tile cache pool, the calculation time of the slope tile data and the direction tile data can be saved, thereby improving the efficiency of the shading map publishing.
[0049] If it is determined in step S405 that the search fails, the corresponding DEM tile is obtained from the digital elevation model DEM data, and the slope tile data and the aspect tile data are calculated based on the obtained DEM tile, as shown in step S409.
[0050] It should be understood that since a 3*3 image operator is required to calculate the shading map tiles, in order to ensure the integrity of the shading map data within the tile range, a pixel range can be expanded when obtaining the tiles used for calculation. For example, when obtaining the expected 256*256 size tile, a 258*258 size tile can be actually obtained, that is, when obtaining the expected N*N size tile, a (N+2)*(N+2) size tile can be actually obtained. By expanding a pixel range when actually obtaining the tiles, the incompleteness of the shading map data can be avoided, ensuring that the complete shading map data is obtained.
[0051] For example, starting from the upper left corner of the 258*258 tile, the first calculation result is the slope and aspect value of the 3*3 center point in the second row and second column. Continue sliding calculation, and the result of each calculation is the slope and aspect value of the 3*3 center point. Slide calculation from the upper left corner to the lower right corner. After the calculation is completed, you can get the 256*256 slope and aspect tile. Referring to the figure below, e is the grid point to be calculated, and the data in the 3*3 window around it is expanded outward to calculate the slope tile data and aspect tile data of the e position. a, b, c, d, f, g, h and i are the eight grid points around the e position, and their specific values are the elevation values of the grid point positions.
[0052]
[0053] Downward is the positive y direction, and rightward is the positive x direction. The third-order inverse distance square weighted difference formula is used:
[0054] dx=((c+2f+i)-(a+2d+g)) / (8*x_cell_size)
[0055] dy=((g+2h+i)-(a+ab+c)) / (8*y_cell_size)
[0056] key = sqrt(dx^2+dy^2)
[0057] Slop_rad=atan(key)
[0058] Aspect_rad=atan2(dy,-dx)
[0059] in,
[0060] dx and dy represent the height difference in the X and Y directions respectively (normalized based on resolution);
[0061] x_cell_size and y_cell_size represent the resolution of the data in the X and Y directions respectively.
[0062] key means: height difference after integration in XY direction;
[0063] Slop_rad means: the radian value of the slope;
[0064] Aspect_rad means: the arc value of the slope aspect.
[0065] Based on this method, dynamic slope and aspect tile services can be supported.
[0066] It should be understood that other calculation methods known to those skilled in the art may also be used to calculate the slope tile data and the aspect tile data.
[0067] In one embodiment, tiles for which slope tile data and aspect tile data have been calculated can be added to a tile cache pool to generate slope aspect cache tiles. It can be understood that the capacity of the tile cache pool is limited, therefore, a priority can be set for the slope aspect cache tile, and the initial value of the priority is an initial priority, for example, the initial priority is 1.0. When the slope aspect cache tile is accessed once, the priority is increased by a predetermined increment, for example, the predetermined increment is 0.2. If it is not accessed after a time threshold, the priority is reduced by a predetermined decrement, for example, the priority is reduced by 0.1 every 5 minutes. When the tile cache pool is full, the slope aspect cache tiles with low priority can be eliminated first. By setting the priority, the tile cache pool can always cache the slope aspect cache tiles that are frequently accessed, thereby improving the cache hit rate and thus improving the efficiency of the rendering map publishing.
[0068] After the slope tile data and the aspect tile data are obtained, in step S411 , the shading map tile data is calculated in real time based on the slope tile data and the aspect tile data, the solar altitude angle and the solar azimuth angle.
[0069] For example, the value of the shading image tile, that is, the shading image tile data, is calculated by the following formula:
[0070] Hillshade=255.0*((cos(Zenith_rad)*cos(Slope_rad))+(sin(Zenith_rad)*sin(Slope_rad)*cos(Azimuth_rad-Aspect_rad)))
[0071] in:
[0072] Hillshade means: the value of the shading tile;
[0073] Zenith_rad means: solar zenith angle, which is the radian value corresponding to 90-sun altitude angle;
[0074] Azimuth_rad means: solar azimuth;
[0075] Slope_rad means: slope;
[0076] Aspect_rad means: slope direction;
[0077] All angles are in radians.
[0078] If the calculation result is <0, the output is directly 0.
[0079] Through real-time calculation, users can request shaded images for any solar altitude and azimuth.
[0080] In one embodiment, the real-time request also includes a color scheme, based on which the shaded image tiles are color mapped to generate output tiles in real time. In this way, user-defined color schemes can be supported.
[0081] In one embodiment, if the user does not specify a color scheme, the output tiles are generated in real time according to a default color scheme.
[0082] The following is a specific example to describe how to use the method described above to publish shading tiles in real time.
[0083] Server 01 receives a real-time request for a shading image tile from terminal 02. Example of the request:
[0084] http: / / localhost:5666 / dem_server? request=GetTile&service=wmts&layer=china90&Format=jpeg&TileMatrixSet=l&TileMatrix=10&TileCol=345&TileRow=1608&azimuth=315&evaluation=45&color_scheme=scheme1
[0085] See also Figure 5 , showing the image tile at that location.
[0086] After receiving the real-time request, server 01 accesses the tile cache pool to find the matching slope and aspect cache tiles. The slope and aspect tiles china90_10_345_1608_slope and china90_10_345_1608_aspect are found in the tile cache pool. Since the slope and aspect tiles are accessed for the first time, they do not exist in the cache and need to be calculated from the original data. Therefore, the corresponding DEM tiles are obtained from the DEM data, and the slope tile data and the aspect tile data are calculated based on the obtained DEM tiles. Through the layer, TileMatrixSet, TileRow and TileCol parameters, the tile geographic range 1 is calculated: [102.65625, 29.1797 102.832, 29.3555], and the geographic range 2 after expanding one pixel is: [102.6555, 29.179 102.8327, 29.35625]. From the layer information, locate the original data file SRTM_57_07.tif and obtain the data of geographic range 2 as 258*258 size tiles. Figure 6 . Process the generated slope and aspect tiles and add them to the tile cache pool, china90_10_345_1608_slope, see Figure 7, china90_10_345_1608_aspect, see Figure 8 .
[0087] Based on the slope tile data, aspect tile data, solar altitude angle and solar azimuth angle, the shading map tile data is calculated in real time. Fig. 9 .
[0088] Based on the real-time calculated shading image tile data, the following can be generated in real time according to the color scheme specified by the user: Fig.10 The tiles shown are sent to the terminal 02. When the user does not specify a color scheme, tiles are generated in real time according to a default color scheme and sent to the terminal 02.
[0089] Corresponding to the above method, the present invention also provides a device for real-time publishing of gradient image tiles, including a processor and a memory, wherein the memory stores computer instructions, and the processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the device implements the steps of the above method.
[0090] The method and device for real-time publishing of shading map tiles provided in the embodiments of this specification do not require the physical storage data of the actual shading map. The relevant local content can be directly obtained through the original DEM, and the shading map of any lighting angle can be calculated in real time to obtain the corresponding tile data and publish it externally. At the same time, the service performance can be improved through the tile caching mechanism.
[0091] The embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned edge computing server deployment method are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0092] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, wherein the computer program / instruction implements the steps of the above method when executed by a processor.
[0093] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.
[0094] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.
[0095] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.
[0096] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for publishing a shading image tile in real time, the method being executed by a server, characterized in that: include: Receive a real-time request for a shaded image tile, the real-time request including a layer, a level, a row number, a column number, a solar altitude angle, and a solar azimuth angle; In response to the real-time request, access the tile cache pool to find a matching slope and direction cache tile; When the slope and aspect cache tile search is successful, obtaining the slope tile data and the aspect tile data from the slope and aspect cache tile; In the case where the slope and aspect cache tile search fails, the corresponding DEM tile is obtained from the digital elevation model DEM data, and the slope tile data and the aspect tile data are calculated based on the obtained DEM tile; Calculating the shading image tile data in real time based on the slope tile data, the aspect tile data, the sun altitude angle, and the sun azimuth angle; Based on the shading image tile data calculated in real time, the shading image tile is published in real time.
2. The method according to claim 1, characterized in that After calculating the slope tile data and aspect tile data, it also includes: Tiles for which slope tile data and aspect tile data have been calculated are added to the tile cache pool to generate slope and aspect cache tiles.
3. The method according to claim 2, characterized in that After generating the slope and aspect cache tiles, further steps include: Setting a priority for the slope and direction cache tile, wherein an initial value of the priority is an initial priority; When the slope direction cache tile is accessed once, the priority is increased by a predetermined value; If it has not been accessed for a time threshold, the priority is reduced by a predetermined decrement value; When the tile cache pool is full, the slope direction cache tiles with low priority are eliminated.
4. The method according to any one of claims 1 to 3, characterized in that The real-time request includes a color scheme; The real-time publishing of the shading image tile also includes: Based on the color scheme, color mapping is performed on the shading image tile to generate an output tile.
5. The method according to any one of claims 1 to 3, characterized in that: The corresponding DEM tile is obtained from the digital elevation model DEM data, and a pixel range is expanded to obtain it.
6. A device for publishing shading image tiles in real time, comprising a processor and a memory, characterized in that: The memory stores computer instructions, and the processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the device implements the steps of the method as claimed in any one of claims 1 to 5.
7. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method as claimed in any one of claims 1 to 5 are implemented.
8. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
