Historical terrain grid map optimization drawing method

By using a cache dictionary to cache tile data in the historical terrain raster map drawing method, the inefficiency problem caused by frequent network requests when view changes in the prior art is solved, and more efficient historical terrain raster map drawing is achieved.

CN119557383APending Publication Date: 2025-03-04CHONGQING INST OF SURVEYING & MAPPING SCI & TECH (CHONGQING MAP COMPILATION CENT)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411625006.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

The existing method of dynamic drawing and overlaying of historical terrain raster maps based on tile maps. When the current view of AutoCAD software changes, all map tiles contained in the new view range need to be recalculated, requested and drawn, resulting in time-consuming network requests and seriously affecting the drawing efficiency.

Method used

Setting a cache dictionary to cache previously obtained historical terrain raster map tile data. When the view changes, the required map tile data is read from the cache dictionary for drawing, reducing network requests for map tile.

Benefits of technology

Reduces network requests for map tiles, improves the efficiency of dynamic drawing of historical terrain raster maps, and improves the drawing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557383A_ABST
    Figure CN119557383A_ABST
Patent Text Reader

Abstract

The invention discloses an optimized drawing method for a historical terrain grid map, which comprises the following steps of: firstly, according to a line and column number range of a map tile required by a current view, requesting a WMTS service through a network to obtain corresponding map tile data, and storing the map tile data into a cache dictionary; when the view changes, on the basis of the characteristic that the view change caused by user operation has coherence, according to the row and column number range corresponding to the required map tile data after the view changes, whether the required map tile data exists or not is searched from the cache dictionary, and if the required map tile data exists, the map tile data is stored; if yes, corresponding map tile data are directly read from the cache dictionary to draw the historical terrain grid map. In this way, the number of network requests for the map tiles can be reduced, and the efficiency of dynamically drawing the historical terrain grid map is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of geographic information database information retrieval, and in particular to a method for optimizing the drawing of a historical terrain grid map. Background Art

[0002] With the rapid advancement of urbanization in my country, the surface morphology of urban areas has undergone drastic changes. In this process, the field of urban survey has accumulated a large number of historical topographic map materials reflecting the topographic and geomorphic characteristics of different historical periods. In order to facilitate search and use, they are usually scanned and digitized and stored in the form of raster images. Engineering survey is an activity to identify, analyze and evaluate the geological, environmental characteristics and geotechnical engineering conditions of the construction site. Historical topographic map data can reveal the original topographic and geomorphic characteristics of the target area in a specific historical period, which is conducive to the optimization of the survey plan and the evaluation of the geological conditions of the site. It is an important reference for engineering survey. Therefore, it is very necessary to realize the efficient drawing of historical topographic raster maps in engineering surveys.

[0003] The conventional technical solution for implementing the overlay application of historical terrain raster maps in engineering surveys is to manually import the historical terrain raster maps and use them as reference base maps. First, apply for the call of the historical terrain raster maps, then open the engineering survey AutoCAD production environment to import multiple historical terrain raster maps into AutoCAD, and position, rotate, scale and other operations on them in turn to make them in the correct spatial position, and finally adjust the layer drawing order to avoid covering other elements.

[0004] However, since this technical solution is cumbersome to operate and occupies a large amount of memory, it is easy to cause program jams, resulting in low efficiency in drawing historical terrain raster maps. In addition, due to the direct call of the original image file, data security cannot be guaranteed. Therefore, a dynamic drawing and overlay application method of historical terrain raster maps based on tile maps came into being. First, the historical terrain raster map is published as a WMTS service that complies with the OGC standard, and then the efficient drawing and overlay application of tile maps in AutoCAD is realized through AutoCAD secondary development. This solution has a high degree of automation, smooth program operation, and effectively guarantees data security by providing data services rather than original data files.

[0005] However, the existing dynamic drawing and overlay application method of historical terrain raster maps based on tile maps requires recalculating, requesting and drawing all map tiles contained in the new view range every time the current view of AutoCAD software changes. The network request is very time-consuming, which seriously affects the drawing efficiency of historical terrain raster maps. The drawing efficiency still needs to be further improved. Summary of the invention

[0006] In view of the shortcomings of the prior art, the present invention proposes a method for optimizing the drawing of historical terrain grid maps, which can further improve the drawing efficiency of historical terrain grid maps. The specific technical solution is as follows:

[0007] A method for optimizing the drawing of a historical terrain grid map is provided. In a first achievable manner, the method includes:

[0008] Request the corresponding map tile data according to the row and column number range of the map tile that needs to be drawn in the current view, and store the requested map tile data in the cache dictionary;

[0009] When the view changes, the corresponding map tile data is retrieved from the cache dictionary according to the row and column number range of the map tile that needs to be drawn after the view changes to draw the historical terrain grid map.

[0010] In combination with the first implementable manner, in the second implementable manner, requesting corresponding map tile data according to the row and column number range includes:

[0011] Calculate the view scale based on the current view, the current screen width, and the number of pixels per inch;

[0012] Determine the map tile level that should be drawn currently by using the view scale;

[0013] The range of row and column numbers corresponding to the map tiles to be drawn is determined according to the map tile level.

[0014] In combination with the second possible implementation, in a third possible implementation, determining the range of row and column numbers corresponding to the map tiles to be drawn according to the map tile level includes:

[0015] Determine the coordinate range of the current view according to the map resolution corresponding to the map tile level, the center point coordinates of the current view and the current screen size;

[0016] The range of row and column numbers corresponding to the map tiles to be drawn is determined by combining the current view coordinate range, map resolution, and the origin coordinates and tile size in the slicing scheme.

[0017] In combination with the second possible implementation, in a fourth possible implementation, determining the range of row and column numbers corresponding to the map tiles to be drawn according to the map tile level includes:

[0018] The range of row and column numbers corresponding to the map tiles to be drawn is determined based on the set project scope, the origin coordinates and tile size in the slicing scheme, and the map resolution corresponding to the map tile level.

[0019] In combination with the first implementable manner, in a fifth implementable manner, requesting corresponding map tile data according to a row and column number range includes:

[0020] All row and column number combinations in the row and column number range are traversed, and for each row and column number combination, an independent thread is created to request map tile data.

[0021] In combination with the first possible implementation, in a sixth possible implementation, when new map tile data is acquired, if the amount of map tile data stored in the cache dictionary exceeds a limit, the stored map tile data are removed in order of storage time.

[0022] In combination with the first implementable manner, in a seventh implementable manner, each map tile data stored in the cache dictionary is respectively configured with a unique identifier.

[0023] In combination with the first implementable manner, in an eighth implementable manner, drawing a historical terrain grid map includes:

[0024] Selecting a map point from the drawn historical terrain grid map, and calculating the offset of the historical terrain grid map according to the coordinates of the map point and the coordinates of the corresponding control point;

[0025] The coordinates of the positioning point corresponding to the map tile data are corrected according to the offset.

[0026] In combination with the first implementable method, in a ninth implementable method, drawing a historical terrain grid map includes:

[0027] Convert the map tile data into a map tile image of Bitmap type;

[0028] Convert a Bitmap-type map tile image to a byte stream, and replace the Alpha channel value of each pixel with the set transparency control variable during the conversion process;

[0029] Based on the byte stream, the ImageBGRA32 type map tile data is constructed to draw the historical terrain raster map.

[0030] In combination with the first possible implementation, the tenth possible implementation further includes:

[0031] All map tile data drawn in the current view are stitched together to obtain a historical terrain raster map;

[0032] The spliced ​​historical terrain raster map is attached to the current AutoCAD active document in raster reference mode for printing.

[0033] Beneficial effect: The method for optimizing the drawing of historical terrain grid maps of the present invention can cache the tile data of the historical terrain grid maps previously acquired by setting a cache dictionary. Based on the coherence of the view changes caused by user operations, when the view changes, the map tile data required after the partial view change can be read from the cache dictionary first, thereby reducing the network request for the map tiles and improving the efficiency of the dynamic drawing of the historical terrain grid maps. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the specific implementation of the present invention, the following will briefly introduce the drawings required for use in the specific implementation. In all the drawings, each element or part is not necessarily drawn according to the actual scale.

[0035] Figure 1 A flowchart of a method for optimizing the drawing of a historical terrain grid map provided by an embodiment of the present invention;

[0036] Figure 2 A historical topographic grid map is drawn using a historical topographic grid map optimization drawing method of the present invention. DETAILED DESCRIPTION

[0037] The following embodiments of the technical solution of the present invention are described in detail in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and are therefore only used as examples, and cannot be used to limit the protection scope of the present invention.

[0038] Embodiment 1

[0039] like Figure 1 A flowchart of a method for optimizing the drawing of a historical terrain grid map is shown, and the drawing method includes:

[0040] Step 1: Request the corresponding map tile data according to the row and column number range of the map tile that needs to be drawn in the current view, and store the requested map tile data in the cache dictionary;

[0041] Step 2: When the view changes, the corresponding map tile data is retrieved from the cache dictionary according to the row and column number range of the map tile that needs to be drawn after the view changes to draw the historical terrain grid map.

[0042] Specifically, first, according to the row and column number range of the map tiles required by the current view, a WMTS service that complies with the OGC standard can be requested through the network to obtain the corresponding map tile data. After obtaining the map tile data, it can be stored in a cache dictionary, and a historical terrain raster map can be drawn based on the obtained map tile data. When the view changes, based on the coherence of the view changes caused by user operations, it is possible to find out whether the required map tile data exists from the cache dictionary according to the row and column number range corresponding to the map tile data required after the view changes. If not, the WMTS service is still requested through the network. If it exists, the corresponding map tile data is directly read from the cache dictionary to draw the historical terrain raster map. In this way, the network requests for map tiles can be reduced, and the efficiency of dynamic drawing of historical terrain raster maps can be improved.

[0043] In this embodiment, optionally, requesting corresponding map tile data according to a row and column number range includes:

[0044] Calculate the view scale based on the current view, the current screen width, and the number of pixels per inch;

[0045] Determine the map tile level that should be drawn currently by using the view scale;

[0046] The range of row and column numbers corresponding to the map tiles to be drawn is determined according to the map tile level.

[0047] Specifically, when requesting a WMTS service, the view scale can be calculated based on the current view, the width of the current screen, and the number of pixels per inch. The specific calculation formula is as follows:

[0048] Scale = (R × DPI) ÷ 0.0254;

[0049] R=VW÷SW;

[0050] Among them, Scale is the view scale, VW and SW are the width of the current view and the width of the current screen respectively, and DPI is the number of pixels per inch (0.0254m).

[0051] After calculating the view scale, the view scale can be compared with the scales of each tile level of the detail level model obtained in the WMTS service to determine the map tile level that should be drawn currently. Specifically, Level[i] and Level[i+1] are two adjacent map tile levels, s[i] and s[i+1] are their corresponding scales, and when Scale>s[i+1] and Scale<=s[i], Level[i] is the map tile level at which the map tile currently needs to be drawn. Finally, the row and column number range corresponding to the map tile data that needs to be drawn in the current view is determined based on the map tile level.

[0052] In this embodiment, optionally, determining the range of row and column numbers corresponding to the map tiles to be drawn according to the map tile level includes:

[0053] Determine the coordinate range of the current view according to the map resolution corresponding to the map tile level, the coordinates of the center point of the current view and the current screen size;

[0054] The range of row and column numbers corresponding to the map tiles to be drawn is determined by combining the current view coordinate range, map resolution, and the origin coordinates and tile size in the slicing scheme.

[0055] Specifically, when determining the row and column number range corresponding to the map tile data to be drawn, the current view coordinate range (minX, maxX, minY, minY) can be determined based on the map resolution corresponding to the map tile level, the center point coordinates of the current view, and the current screen size. The specific calculation formula is as follows:

[0056]

[0057] Among them, r is the map resolution corresponding to the map tile level in the detail level model, CX and CY are the horizontal and vertical coordinates of the center point of the current view, and SW and SH are the width and height of the current screen size, respectively.

[0058] Then, the row and column number range (minRow, minCol, maxRow, maxCol) corresponding to the map tiles to be drawn is determined by combining the current view coordinate range, map resolution, and the origin coordinates and tile size in the slicing scheme. The specific calculation formula is as follows:

[0059]

[0060] Among them, OX, OY, H, and W are the horizontal and vertical coordinates of the origin of the slicing scheme in the detail level model LOD and the height and width of the tile respectively.

[0061] In this embodiment, optionally, requesting corresponding map tile data according to a row and column number range includes:

[0062] All row and column number combinations in the row and column number range are traversed, and for each row and column number combination, an independent thread is created to request map tile data.

[0063] Specifically, all row and column number combinations in the row and column number range of the map tiles to be drawn can be traversed, and for each row and column number combination, a separate thread is created, and the following network request address is created according to the row and column number:

[0064] TileUrl=RESTURL+“ / tile / LevelId / Row0 / Col0”

[0065] RESTURL is the service address that provides WMTS service, LevelId is the level number of the map tile, and Row0 and Col0 are the row and column numbers, which need to be replaced with actual values. By initiating an HTTP network request based on TileUrl, you can obtain the required map tile data, that is, the raster image in Image format. This can improve the efficiency of map tile requests and the efficiency of dynamic drawing of historical terrain raster maps.

[0066] In this embodiment, optionally, when new map tile data is acquired, if the number of map tile data stored in the cache dictionary exceeds a limit, the stored map tile data are removed in order of storage time.

[0067] Specifically, in order to improve the efficiency of historical terrain raster map drawing while avoiding taking up too much memory space, the cache dictionary can be set to a fixed capacity. Every time a user operation causes a view change, if new map tile data is obtained through a network request, it is added to the cache dictionary for storage. When the amount of stored map tile data exceeds the limit, the older records are removed in turn.

[0068] Specifically, after newly acquiring map tile data, first determine whether the same map tile data already exists in the cache dictionary. If not, in order to facilitate subsequent searches for map tile data, a unique identifier can be configured for the newly acquired map tile data, and an identifier for the tile to be drawn can be created based on the tile level, row number, and column number. When searching for map tiles later, you can search based on the identifier to improve the efficiency of dynamic drawing of historical terrain raster maps. If so, remove the same map tile data originally stored in the cache dictionary, and then configure the newly acquired identifier.

[0069] Then, it is determined whether the amount of map tile data stored in the cache dictionary has exceeded the capacity. If not, the map tile data configured with the unique identifier is stored in the cache dictionary. Otherwise, according to the storage record linked list sorted by storage time, the earliest stored map tile data is deleted, and the newly acquired map tile data is stored in the cache dictionary, and finally the storage record linked list is updated according to the identifier and storage time of the newly acquired map tile data.

[0070] In this embodiment, optionally, drawing the historical terrain grid map includes:

[0071] Selecting a map point from the drawn historical terrain grid map, and calculating the offset of the historical terrain grid map according to the coordinates of the map point and the coordinates of the corresponding control point;

[0072] The coordinates of the positioning point corresponding to the map tile data are corrected according to the offset.

[0073] Specifically, in the actual drawing process, the drawn historical terrain grid map may be partially offset. To this end, a map point and its corresponding control point can be selected on the previously drawn historical terrain grid map, and the offset can be calculated based on the map coordinates of the map point and the control point. Then, the calculated positioning point coordinates of the map tile data can be adjusted according to the offset to effectively correct the local offset of the historical terrain grid map. For the positioning point coordinates position (X, Y, Z) corresponding to the map tile data, the following calculation formula can be used for calculation:

[0074] X = OX + minCol × W;

[0075] Y = OY + minRow × H × (-1);

[0076] Z = 0;

[0077] Among them, OX, OY, H, and W are the horizontal and vertical coordinates of the origin of the slicing scheme and the height and width of the tile respectively.

[0078] In this embodiment, optionally, drawing the historical terrain grid map includes:

[0079] Convert the map tile data into a map tile image of Bitmap type;

[0080] Convert a Bitmap-type map tile image to a byte stream, and replace the Alpha channel value of each pixel with the set transparency control variable during the conversion process;

[0081] Based on the byte stream, the ImageBGRA32 type map tile data is constructed to draw the historical terrain raster map.

[0082] Specifically, when drawing a historical terrain raster map, you can first convert the acquired map tile data to a Bitmap type. Then convert the Bitmap type map tile data to a byte stream. During this process, you need to take the values ​​of the four channels of Blue, Green, Red, and Alpha for each pixel of the Bitmap image in turn and store them in the specified location. At the same time, you can replace the value of the Alpha channel of each pixel according to the set transparency control variable, thereby realizing the transparency control of the map tile data. Finally, you can create ImageBGRA32 type map tile data based on the byte stream.

[0083] In this embodiment, optionally, it further includes:

[0084] All map tile data drawn in the current view are stitched together to obtain a historical terrain raster map;

[0085] Attach the spliced ​​historical terrain raster map to the current AutoCAD active document in raster reference mode.

[0086] Specifically, it should be understood that the existing historical terrain grid map drawing method cannot print out the map. To this end, the image insertion point coordinates P'(X', Y'), image width W' and height H' of the drawn historical terrain grid map can be determined first according to the row and column number range, origin coordinates and tile size. The specific calculation formula is as follows:

[0087] X′=OX+minCol×W;

[0088] Y'=OY+(maxRow+1)×H×(-1);

[0089] W' = (maxCol - minCol + 1) × E;

[0090] H′=(maxRow-minRow+1)×H.

[0091] After determining the image insertion point coordinates P'(X', Y'), image width W' and height H', the size of the merged historical terrain raster map can be determined based on the image width W' and height H', and then a new Bitmap object is created based on the size. Then, the map tiles to be drawn are taken out in turn, and the value of each pixel is assigned to the corresponding position of the newly created Bitmap object to complete the tile splicing. Finally, the spliced ​​historical terrain raster map is attached to the current AutoCAD document in raster reference mode. In this way, the historical terrain raster map corresponding to the current view and other graphic elements in the AutoCAD document can be printed out together.

[0092] Embodiment 2

[0093] The second embodiment is substantially the same as the first embodiment, and the main difference is that: determining the range of row and column numbers corresponding to the map tiles to be drawn according to the map tile level includes:

[0094] The range of row and column numbers corresponding to the map tiles to be drawn is determined based on the set project scope, the origin coordinates and tile size in the slicing scheme, and the map resolution corresponding to the map tile level.

[0095] Specifically, in actual application, we usually only focus on the situation within the scope of the project, and there is no need to draw the historical terrain grid map within the entire view range. Therefore, when determining the row and column number range corresponding to the map tiles that need to be drawn, you can draw a rectangular area containing the range according to the project scope where the historical terrain grid map needs to be drawn. The coordinate range of the rectangular area is RectExtent (minX', maxX', minY', maxY'). Then calculate the row and column number range of the map tiles to be drawn based on the coordinate range RectExtent (minX', maxX', minY', maxY'). The specific calculation formula is as follows:

[0096]

[0097] This can reduce the number of map tiles requested and drawn, effectively improving the drawing efficiency of historical terrain raster maps.

[0098] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.

Claims

1. A method for optimizing the drawing of a historical terrain grid map, characterized in that: include: Request the corresponding map tile data according to the row and column number range of the map tile that needs to be drawn in the current view, and store the requested map tile data in the cache dictionary; When the view changes, the corresponding map tile data is retrieved from the cache dictionary according to the row and column number range of the map tile that needs to be drawn after the view changes to draw the historical terrain grid map.

2. The method for optimizing and drawing a historical terrain grid map according to claim 1, characterized in that: Request the corresponding map tile data according to the row and column number range, including: Calculate the view scale based on the current view, the current screen width, and the number of pixels per inch; Determine the map tile level that should be drawn currently by using the view scale; The range of row and column numbers corresponding to the map tiles to be drawn is determined according to the map tile level.

3. The method for optimizing and drawing a historical terrain grid map according to claim 2, characterized in that: Determining the range of row and column numbers corresponding to the map tiles to be drawn according to the map tile level includes: Determine the coordinate range of the current view according to the map resolution corresponding to the map tile level, the coordinates of the center point of the current view and the current screen size; The range of row and column numbers corresponding to the map tiles to be drawn is determined by combining the current view coordinate range, map resolution, and the origin coordinates and tile size in the slicing scheme.

4. The method for optimizing and drawing a historical terrain grid map according to claim 2, characterized in that: Determining the range of row and column numbers corresponding to the map tiles to be drawn according to the map tile level includes: The range of row and column numbers corresponding to the map tiles to be drawn is determined based on the set project scope, the origin coordinates and tile size in the slicing scheme, and the map resolution corresponding to the map tile level.

5. The method for optimizing and drawing a historical terrain grid map according to claim 1, characterized in that: Request the corresponding map tile data according to the row and column number range, including: All row and column number combinations in the row and column number range are traversed, and for each row and column number combination, an independent thread is created to request map tile data.

6. The method for optimizing and drawing a historical terrain grid map according to claim 1, characterized in that: When new map tile data is obtained, if the number of map tile data stored in the cache dictionary exceeds a limit, the stored map tile data are removed in order of storage time.

7. The method for optimizing and drawing a historical terrain grid map according to claim 1, characterized in that: Each map tile data stored in the cache dictionary is respectively configured with a unique identifier.

8. The method for optimizing and drawing a historical terrain grid map according to claim 1, characterized in that: Drawing historical terrain raster maps includes: Selecting a map point from the drawn historical terrain grid map, and calculating the offset of the historical terrain grid map according to the coordinates of the map point and the coordinates of the corresponding control point; The coordinates of the positioning point corresponding to the map tile data are corrected according to the offset.

9. The method for optimizing and drawing a historical terrain grid map according to claim 1, characterized in that: Drawing historical terrain raster maps includes: Convert the map tile data into a map tile image of Bitmap type; Convert a Bitmap-type map tile image to a byte stream, and replace the Alpha channel value of each pixel with the set transparency control variable during the conversion process; Based on the byte stream, the ImageBGRA32 type map tile data is constructed to draw the historical terrain raster map.

10. The method for optimizing and drawing a historical terrain grid map according to claim 1, characterized in that: Also includes: All map tile data drawn in the current view are stitched together to obtain a historical terrain raster map; The spliced ​​historical terrain raster map is attached to the current AutoCAD active document in raster reference mode for printing.