Unified map tile access method, device, equipment and storage medium
By using the target tile conversion algorithm in the map service, the map tile data of different specifications is converted into unified specifications, which solves the problem of map tile access of different specifications, and realizes unified access and efficient display of map services.
Patent Information
- Application Number
- CN202510025066.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-07
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-01-07
AI Technical Summary
There are specification differences in the tile map services implemented by different manufacturers, making it difficult to access and interoperate map tiles of different specifications.
By determining the map range to be displayed and the current map level, the target tile conversion algorithm is used to convert the original specification map tile data into the target specification map tile, thereby achieving the access and display of map tile tiles of different specifications.
Without modifying the front-end code, the conversion and display of map tiles of different specifications is realized, which improves the scalability and adaptability of the system.
Smart Images

Figure CN119478317B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of map service interoperability, and in particular to a unified map tile access method, device, equipment and storage medium. Background Art
[0002] TMS (Tile Map Service) is a network map protocol that defines the rules for requesting and providing map tiles. When different vendors implement this protocol within this framework, there will be some differences in implementation, resulting in many tiles of different specifications.
[0003] How to achieve access to map tiles of different specifications has become a hot research direction. Summary of the invention
[0004] In view of this, the present application provides a unified map tile access method, device, equipment and storage medium.
[0005] According to a first aspect of an embodiment of the present application, a unified map tile access method is provided, including:
[0006] Determine the target map tile to be displayed based on the map range to be displayed and the current map level;
[0007] For any target specification map tile, the target specification map tile is generated by using a target tile conversion algorithm according to the original specification map tile data; wherein the target tile conversion algorithm is determined according to the target specification and the original specification, and is used to realize the conversion of the original specification map tile to the target specification map tile;
[0008] The map is displayed according to the generated target specification map tiles.
[0009] According to a second aspect of an embodiment of the present application, a unified map tile access device is provided, including:
[0010] A determination unit is configured to determine a target specification map tile to be displayed according to a map range to be displayed and a current map level;
[0011] The conversion unit is configured to generate the target specification map tile for any target specification map tile according to the original specification map tile data by using the target tile conversion algorithm; wherein the target tile conversion algorithm is determined according to the target specification and the original specification, and is used to realize the conversion of the original specification map tile to the target specification map tile;
[0012] The display unit is configured to display the map according to the generated target specification map tiles.
[0013] According to a third aspect of an embodiment of the present application, there is provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0014] Memory, used to store computer programs;
[0015] The processor is used to implement the method provided in the first aspect when executing the program stored in the memory.
[0016] According to a fourth aspect of an embodiment of the present application, a non-temporary computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the method provided in the first aspect is implemented.
[0017] The map tile access method of the embodiment of the present application determines the target specification map tile to be displayed based on the map range to be displayed and the current map level. For any target specification map tile, the target specification map tile is generated based on the original specification map tile data using the target tile conversion algorithm. Then, the map display can be performed based on the generated target specification map tile. By designing a conversion algorithm for converting map tiles of different specifications according to requirements, it is possible to generate and display another target specification map tile based on the existing specification map tile data without modifying the front-end code to adapt to the TMS service. In addition, by designing a new tile conversion algorithm according to requirements, it is possible to support the conversion of map tiles of more specifications, and the solution has strong scalability. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flowchart of a unified map tile access method provided by an embodiment of the present application;
[0019] Figure 2 This is a schematic diagram of a Web Mercator tile to WGS84 tile algorithm flow provided in an embodiment of the present application;
[0020] Figure 3A is a schematic diagram of a geographical range a1 corresponding to a WGS84 tile provided in an embodiment of the present application;
[0021] Figure 3B It is a schematic diagram of three web Mercator tiles associated with a WGS84 tile provided in an embodiment of the present application;
[0022] Figure 3C It is a schematic diagram of merging associated Web Mercator tiles to generate a complete picture provided by an embodiment of the present application;
[0023] Figure 3D is a schematic diagram of cropping the image S1 using the geographic range a1 corresponding to the WGS84 tile provided in an embodiment of the present application;
[0024] Figure 4 This is a schematic diagram of an algorithm flow for converting GCJ02 deflected Web Mercator tiles to WGS84 tiles provided in an embodiment of the present application;
[0025] Figure 5 It is a comparative schematic diagram of a geographical range represented by a BD09 tile provided in an embodiment of the present application in a BD09 coordinate system and a WGS84 coordinate system;
[0026] Figure 6 This is a schematic diagram of an algorithm flow for converting BD09 biased Web Mercator tiles to WGS84 tiles provided in an embodiment of the present application;
[0027] Figure 7 It is a structural schematic diagram of a unified map tile access device provided in an embodiment of the present application;
[0028] Figure 8 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.
[0030] It should be noted that the serial numbers of the steps in the embodiments of the present application do not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0031] See also Figure 1 , is a flow chart of a unified map tile access method provided in an embodiment of the present application, such as Figure 1 As shown, the unified map tile access method may include the following steps:
[0032] Step S100: Determine the target map tile to be displayed based on the map range to be displayed and the current map level.
[0033] In the embodiment of the present application, when a map display is required, the target specification map tile to be displayed can be determined based on the map range to be displayed and the current map level.
[0034] Exemplarily, the range of the map to be displayed may be determined according to the size of the display interface (eg, screen size).
[0035] The target specification is a preset map tile specification that needs to be displayed.
[0036] For example, the target specification may include a commonly used map tile specification, such as a WGS84 specification or a Web Mercator specification.
[0037] It should be noted that in the embodiments of the present application, unless otherwise specified, the target specification map tile can be a WGS84 specification map tile with a size of 256*256.
[0038] Step S110, for any target specification map tile, generate the target specification map tile according to the original specification map tile data using the target tile conversion algorithm; wherein the target tile conversion algorithm is determined according to the target specification and the original specification, and is used to realize the conversion of the original specification map tile to the target specification map tile.
[0039] In an embodiment of the present application, in order to display map tiles of specified specifications based on map tile data of different specifications, a tile conversion algorithm (also referred to as a TMS conversion algorithm) between map tiles of different specifications can be pre-designed. The tile conversion algorithm can be used to generate map tiles of another specification based on map tile data of one specification.
[0040] For example, the above tile conversion algorithm can be used to convert map tiles of uncommon specifications into map tiles of common specifications; or, it can be used to convert map tiles of one common specification into map tiles of another common specification.
[0041] Accordingly, the corresponding target tile conversion algorithm can be determined according to the target specification and the original specification.
[0042] For any target specification map tile, the target specification map tile can be generated based on the original specification map tile data using a target tile conversion algorithm.
[0043] Exemplarily, the original standard map data may be obtained according to address information (such as URL (Uniform Resource Locator)) of the original standard map data.
[0044] Exemplarily, the address information of the original specification map data may be pre-configured.
[0045] Exemplarily, the specifications of a map tile may be identified using metadata of the map tile.
[0046] Exemplarily, the metadata of a map tile may include, but is not limited to, parameters such as the slice origin (ie, the geographic coordinates of the vertex of the first tile), resolution, coordinate system, and tile size.
[0047] Step S120: displaying a map according to the generated target specification map tiles.
[0048] In an embodiment of the present application, when the target specification map tiles to be displayed are generated in the above manner, map display can be performed based on the generated target specification map tiles, thereby realizing map display based on the target specification map tiles based on the original specification map tile data.
[0049] It can be seen that in Figure 1 In the method flow shown, the target specification map tile to be displayed is determined based on the map range to be displayed and the current map level. For any target specification map tile, the target specification map tile is generated based on the original specification map tile data using the target tile conversion algorithm. Then, the map display can be performed based on the generated target specification map tile. By designing a conversion algorithm for converting map tiles of different specifications according to requirements, it is possible to generate and display another target specification map tile based on the existing specification map tile data without modifying the front-end code to adapt to the TMS service. In addition, by designing a new conversion algorithm according to requirements, it is possible to support the conversion of map tiles of more specifications, and the solution has strong scalability.
[0050] In some embodiments, the above-mentioned generating the target specification map tile by using the target conversion algorithm based on the original specification map tile data may include:
[0051] Determine the geographical range corresponding to the target specification map tile according to the tile number of the target specification map tile;
[0052] Determine the original specification map tile associated with the target specification map tile according to the geographical range corresponding to the target specification map tile and the association relationship between the geographical range corresponding to the original specification map tile and the geographical range corresponding to the target specification map tile;
[0053] Based on the original specification map tiles, an original specification map image is generated by merging, and the original specification map image is automatically geo-referenced to obtain a map image with geographic coordinate information;
[0054] The target specification map tile is generated according to the geographical range corresponding to the target specification map tile and the map image with geographical coordinate information.
[0055] Exemplarily, for any target specification map tile, the geographical range corresponding to the target specification map tile can be determined based on the tile number of the target specification map tile.
[0056] Exemplarily, the tile number of a map tile may include a map level (ie, a map zoom level), a row number of the map tile, and a column number of the map tile.
[0057] For example, the tile number of a map tile may be (z=17, x=109308, y=21761), and the map tile may be determined to be the map tile at the 109308th column and the 21761th row at level 17 (the 17th zoom level).
[0058] Exemplarily, the geographical scope corresponding to the target specification map tile and the association relationship between the geographical scope corresponding to the original specification map tile and the geographical scope corresponding to the target specification map tile can be used to determine the geographical scope corresponding to the original specification map tile associated with the geographical scope corresponding to the target specification map tile, and the original specification map tile associated with the target specification map tile can be determined based on the geographical scope corresponding to the original specification map tile.
[0059] For example, assuming that the target specification map tile is a WGS84 tile and the original specification map tile is a Web Mercator tile, then a Web Mercator tile associated with a WGS84 tile may include three Web Mercator tiles that are adjacent to each other.
[0060] Assuming that the target specification map tile is a WGS84 tile and the original specification map tile is a GCJ02 plus biased Web Mercator tile, then one WGS84 tile is associated with 3 rows and 3 columns of GCJ02 plus biased Web Mercator tiles, for a total of 9 GCJ02 plus biased Web Mercator tiles.
[0061] In one example, the original specification map tile uses encrypted geographic coordinates; the target specification map tile uses standard unencrypted geographic coordinates; or, the target specification map tile uses encrypted geographic coordinates; the original specification map tile uses standard unencrypted geographic coordinates;
[0062] Determining the original specification map tile associated with the target specification map tile based on the geographical range corresponding to the target specification map tile and the association relationship between the geographical range corresponding to the original specification map tile and the geographical range corresponding to the target specification map tile may include:
[0063] According to the association relationship between the geographical range corresponding to the original specification map tile and the geographical range corresponding to the target specification map tile, the geographical range corresponding to the target specification map tile is converted into the geographical range under the coordinate system of the original specification map tile;
[0064] The original specification map tile associated with the target specification map tile is determined according to the geographic range in the original specification map tile coordinate system.
[0065] For example, considering that for map tiles of different specifications, some map tiles of different specifications use encrypted geographic coordinates, while other map tiles of different specifications use standard unencrypted geographic coordinates, in the process of determining associated map tiles, coordinate conversion is required, and the associated map tiles are determined under the same coordinate system.
[0066] Accordingly, in the process of determining the original specification map tile associated with the target specification map tile, the geographical range corresponding to the determined target map tile can be converted into the geographical range under the original specification map tile coordinate system, and the original specification map tile associated with the target specification map tile can be determined based on the geographical range under the original specification map tile coordinate system.
[0067] Exemplarily, when the original specification map tile associated with the target specification map tile is determined, the original specification map tile can be merged to generate an original specification map image, and the original specification map image can be automatically geo-referenced to obtain a map image with geographic coordinate information.
[0068] Exemplarily, when the original standard map tile associated with the target standard map tile includes multiple original standard map tiles, the multiple original standard map tiles can be merged according to the positional relationship between the multiple original standard map tiles to generate an original standard map image.
[0069] When a map image with geographic coordinate information is obtained, the target-specification map tile may be generated according to the geographic range corresponding to the target-specification map tile and the map image with geographic coordinate information.
[0070] In one example, the above-mentioned automatic geo-referencing of the original standard map image to obtain the map image with geographic coordinate information may include:
[0071] Determine the geographic coordinate information of the control point of the original specification map image in the original specification map tile coordinate system according to the pixel coordinates of the control point of the original specification map image;
[0072] According to the geographic coordinate information of the control points of the original specification map image in the original specification map tile coordinate system, the geographic coordinate information of the control points of the original specification map image in the target specification map tile coordinate system is determined to obtain a map image with geographic coordinate information.
[0073] The above-mentioned generating the target specification map tile according to the geographical range corresponding to the target specification map tile and the map image with geographical coordinate information may include:
[0074] According to the geographic range corresponding to the target specification map tile, a portion of the image with the same geographic range is cropped from the map image with geographic coordinate information to obtain a corresponding screenshot;
[0075] According to the size of the target specification map tile, the screenshot is redrawn to obtain the target specification map tile.
[0076] Exemplarily, the geographic coordinate information of the original specification image in the target specification map tile coordinate system can be determined, and based on the geographic range corresponding to the target specification map tile and the geographic coordinate information of the original specification image in the target specification map tile coordinate system, a screenshot in the original specification image corresponding to the geographic range (i.e., the portion of the image with the same geographic range) can be determined, and then the target specification map tile can be generated based on the screenshot.
[0077] Accordingly, the geographic coordinate information of the control points of the original specification map image in the original specification map tile coordinate system may be determined based on the pixel coordinates of the control points of the original specification map image.
[0078] Exemplarily, the control points of the original specification image may include vertices of the original specification image.
[0079] For example, the upper left vertex and the lower right vertex of the original standard image may be used as control points, or the lower left vertex and the upper right vertex of the original standard image may be used as control points.
[0080] For example, for any pixel in the original standard map image, the geographic coordinate information (taking longitude and latitude as an example) of the pixel in the original standard map tile coordinate system can be obtained in the following manner:
[0081] For pixel coordinates (x p ,y p ), the tile coordinates can be determined by the following formula:
[0082]
[0083]
[0084] Based on the tile coordinates, the total pixel coordinates are determined by the following formula:
[0085]
[0086]
[0087] According to the total pixel coordinates, determine the longitude and latitude of the pixel point:
[0088]
[0089]
[0090] Among them, z is the tile level, T is the tile size, for example, for a 256*256 tile, T=256.
[0091] Exemplarily, when the geographic coordinate information of the control points of the original specification map image in the original specification map tile coordinate system is determined, the geographic coordinate information can be converted based on the geographic coordinate information of the control points of the original specification map image in the original specification map tile coordinate system to determine the geographic coordinate information of the control points of the original specification map image in the target specification map tile coordinate system, thereby obtaining a map image with geographic coordinate information.
[0092] When the map image with geographic coordinate information is obtained, the image portion with the same geographic range can be cropped from the map image with geographic coordinate information according to the geographic range corresponding to the target specification map tile to obtain the corresponding screenshot.
[0093] For example, considering that the size (or length and width or width and height) of the screenshot captured in the above manner may not meet the requirements of the target specification map tile, the screenshot obtained needs to be further redrawn according to the size of the target specification map tile.
[0094] For example, taking the original map tile as Web Mercator tile and the target map tile as WGS84 tile, the size of WGS84 tile is usually 256*256. The height of the screenshot taken from the map image with geographic coordinate information (WGS84 tile coordinate system) obtained in the above manner is usually not 256. Therefore, the screenshot needs to be redrawn to obtain the target map tile of 256*256.
[0095] In some embodiments, the above-mentioned automatic geo-referencing of the original standard map image to obtain a map image with geographic coordinate information may include:
[0096] According to the pixel coordinates of the control points of the original specification map image, the geographic coordinate information of the control points of the original specification map image in the original specification map tile coordinate system is determined to obtain a map image with geographic coordinate information.
[0097] The above-mentioned generating the target specification map tile according to the geographical range corresponding to the target specification map tile and the map image with geographical coordinate information may include:
[0098] For any pixel position in the target specification map tile, determine the geographic coordinate information of the pixel position in the original specification image coordinate system according to the geographic coordinate information of the pixel position;
[0099] According to the geographic coordinate information of the pixel position in the original standard image coordinate system, a pixel value of the pixel position is obtained from the map image with the geographic coordinate information;
[0100] The pixel value is determined as the pixel value of the pixel position of the target specification map tile.
[0101] For example, considering that in actual scenarios, the map resolutions used by map tiles of certain specifications may be inconsistent with those of map tiles of other specifications, and there are random offsets in their coordinate systems, the resulting map tiles will be deformed when the coordinate system is converted. For example, the original map tile is a rectangle, and when the coordinate system is converted, the geographic range of the target specification map tile coordinate system is a rhombus, and there is no regularity in the deformation.
[0102] In response to the above problems, in the process of generating target specification map tiles based on original specification map tile data using a conversion algorithm, pixel processing can be used instead of processing the entire tile. For each pixel position in the target specification map tile, the corresponding pixel position is found in the original specification map tile, and the pixel value of the corresponding pixel position in the target specification map tile is determined based on the pixel value of the pixel position in the original specification map tile.
[0103] Accordingly, in the process of automatic geo-registration of the original map image, the geographic coordinate information of the control points of the original map image in the original map tile coordinate system can be determined based on the pixel coordinates of the control points of the original map image, thereby obtaining a map image with geographic coordinate information.
[0104] That is, the obtained geographic coordinate information of the map image with geographic coordinate information is the geographic coordinate information in the original specification map tile coordinate system.
[0105] When a map image with geographic coordinate information is obtained, for any pixel position in the target specification map tile, the geographic coordinate information of the pixel position is determined in the original specification image coordinate system based on the geographic coordinate information of the pixel position, and based on the geographic coordinate information of the pixel position in the original specification image coordinate system, the pixel value of the pixel position is obtained from the map image with geographic coordinate information, and the pixel value is determined as the pixel value of the pixel position of the target specification map tile.
[0106] In order to enable those skilled in the art to better understand the technical solutions provided in the embodiments of the present application, the technical solutions provided in the embodiments of the present application are described below with reference to specific examples.
[0107] In this embodiment, the differences between map tiles of different specifications are shielded through service proxy, ensuring the uniform access mode of TMS services, and the tile specifications of the service proxy remain uniform (coordinate system, slice origin, tile size, etc. are consistent). The front-end application only needs to write a map access code, and the subsequent switching of services of different map vendors only requires simple configuration. In addition, the map services proxied can be normally superimposed and used because of the consistent specifications, and there will be no misalignment problem.
[0108] In this embodiment, the process of implementing the unified access solution for map tiles of different specifications may include:
[0109] 1) TMS service call: Map applications use unified TMS standards to access TMS services.
[0110] 2) TMS algorithm scheduling: TMS service selects the appropriate algorithm based on the metadata of the service.
[0111] 3) TMS tile conversion: merge and convert non-standard WGS84 map tiles into standard WGS84 coordinate system tiles.
[0112] The implementation of each part is described below.
[0113] 1. TMS service call
[0114] For example, the proxied TMS services will be released according to a unified standard, shielding the differences in TMS services provided by map vendors. For map applications, it is only necessary to connect to this TMS service standard. The front-end application only needs to write a map access code, and subsequent switching of services from different map vendors only requires simple configuration.
[0115] 2. TMS algorithm scheduling.
[0116] For example, when configuring the TMS service agent, some service metadata of the TMS service is entered into the system, such as parameters such as slice origin, resolution, coordinate system, tile size, etc. The system will select an adaptive TMS conversion algorithm based on these parameters to convert the tile data.
[0117] In this embodiment, taking the conversion of non-standard WGS84 map tiles into standard WGS84 tiles as an example, conversion algorithms corresponding to different non-standard WGS84 map tiles can be configured to convert the corresponding non-standard WGS84 map tiles into standard WGS84 tiles.
[0118] For any conversion algorithm, the metadata of non-standard WGS84 map tiles can be used to identify them. Accordingly, in specific applications, the corresponding conversion algorithm can be queried based on the metadata of the map tiles corresponding to the connected map application, and the queried conversion algorithm can be used to convert the map tiles corresponding to the connected map application into standard WGS84 tiles.
[0119] 3. TMS tile conversion.
[0120] Exemplarily, the TMS conversion algorithm library is a pluggable algorithm library that can be continuously iterated and grown.
[0121] For example, the initial version supports TMS service access with WGS84 coordinate system specifications. With the iteration of the system, TMS service access with Web Mercator coordinate system specifications was added. Later, the GCJ02 plus biased Web Mercator coordinate system and BD09 plus biased Web Mercator coordinate system were gradually expanded.
[0122] If necessary, new conversion algorithms can be gradually added, such as route coordinate system specification map tiles (nautical charts) and local coordinate system map tiles.
[0123] The following introduces several common conversion algorithm implementation ideas.
[0124] 3.1. Convert Web Mercator tiles to WGS84 tiles.
[0125] According to the Web Mercator tile division rules, three Web Mercator tiles can be combined and cut into a tile with WGS84 coordinate system specifications, such as Figure 2 As shown in the figure, the algorithm process of converting Web Mercator tiles to WGS84 tiles is designed according to this feature as follows:
[0126] 1. For any WGS84 tile to be displayed, calculate the geographical range a1 corresponding to the WGS84 tile according to the tile number of the WGS84 tile (e.g. z=17, x=109308, y=21761). The schematic diagram can be as follows: Figure 3A shown.
[0127] 2. Calculate the tile number associated with the WGS84 tile in the Web Mercator coordinate system based on its geographic extent a1.
[0128] For example, converting a WGS84 tile requires at most three Web Mercator tiles that are adjacent to each other.
[0129] in, Figure 3B A diagram showing three web Mercator tiles associated with a WGS84 tile.
[0130] 3. Merge the associated Web Mercator tiles to generate a complete image S1, the schematic diagram of which can be shown as follows: Figure 3C shown.
[0131] 4. Automatically georeference image S1.
[0132] Exemplarily, the geographic coordinate information of the image S1 in the Web Mercator tile coordinate system may be determined, and the coordinate information may be converted to obtain the geographic coordinate information in the WGS84 coordinate system.
[0133] Exemplarily, in the process of automatically georeferencing the image S1 , tile vertices may be used as control points.
[0134] For example, the tile vertex coordinates (geographic coordinates in the Web Mercator coordinate system) can be determined by:
[0135] Assume that the vertex pixel coordinates are (x p ,y p ), the tile coordinates can be determined by the following formula:
[0136]
[0137]
[0138] Based on the tile coordinates, the total pixel coordinates are determined by the following formula:
[0139]
[0140]
[0141] According to the total pixel coordinates, determine the longitude and latitude of the pixel point:
[0142]
[0143]
[0144] Among them, z is the tile level and T is the tile size, such as 256.
[0145] 5. Crop image S1 using the geographic extent a1 corresponding to the WGS84 tile.
[0146] For example, the pixel positions of the two vertices at the upper left and lower right in the image S1 are calculated according to the range a1, and the image is captured according to the pixel positions. The schematic diagram thereof can be as follows: Figure 3D shown.
[0147] 6. Redraw the cropped image to obtain a 256*256 WGS84 tile.
[0148] For example, since the height of the screenshot obtained by capturing the image is not 256 and does not meet the WGS84 tile standard, the screenshot can be redrawn on a 256*256 image to obtain a 256*256 WGS84 tile.
[0149] 2. Convert GCJ02 deflected Web Mercator tiles to WGS84 tiles.
[0150] For example, Web Mercator tiles with GCJ02 bias are a common type of map tile, widely used by major Internet map vendors. Although this specification of service protects geographic information security, it also causes confusion in map application access. On the premise of ensuring geographic information security, it needs to be converted into WGS84 specification tiles.
[0151] In the study of GCJ02 deflected web Mercator tiles, it was found that 9 GCJ02 deflected web Mercator tiles can generate a corresponding standard WGS84 tile. Based on this feature, the algorithm process of converting GCJ02 deflected Web Mercator tiles to WGS84 tiles was designed, as shown in the following figure: Figure 4 As shown, the algorithm flow may include:
[0152] 1. For any WGS84 tile to be displayed, calculate the geographic range a1 (WGS84 coordinate system) corresponding to the tile according to the WGS84 tile number.
[0153] 2. Convert the coordinate system of the geographic range a1 to the GCJ02 coordinate system to obtain the geographic range a2.
[0154] 3. According to the geographic range a2, calculate the relevant tile number in the GCJ02 plus biased web Mercator coordinate system.
[0155] 4. The associated GCJ02 plus partial Mercator tiles are merged to generate a complete image S1.
[0156] 5. Automatically georeference image S1.
[0157] Exemplarily, the geographic coordinate information of the image S1 in the GCJ02 plus Mercator tile coordinate system may be determined, and the coordinate information may be converted to obtain the geographic coordinate information in the WGS84 coordinate system.
[0158] 6. Crop image S1 using the geographic extent a1 corresponding to the WGS84 tile.
[0159] 7. Redraw the cropped image to obtain a 256*256 WGS84 tile.
[0160] 3. Convert BD09 biased Web Mercator tiles to WGS84 tiles.
[0161] For example, since the map resolution used by the BD09 coordinate system is inconsistent with the resolution used by the WGS84 conventional TMS, and the geographic range represented by the BD09 tile is a rectangle in the BD09 coordinate system, but after this range is converted to the WGS84 coordinate system, this geographic range is a rhombus, and the BD09 deformation has no regular pattern.
[0162] like Figure 5 As shown, the edge that the arrow points to is theoretically a horizontal straight line, but after the transformation they are not on the same horizontal line.
[0163] Therefore, if the conversion method in the above example is used to convert BD09 biased Web Mercator tiles to WGS84 tiles, some elements will be misplaced.
[0164] To address the problem caused by the random offset of the BD09 coordinate system, considering that any pixel on the BD09 map has a corresponding pixel in the WGS84 coordinate system, the processing of one pixel replaces the original processing of the entire tile.
[0165] like Figure 6 As shown, the algorithm flow may include:
[0166] 1. For any WGS84 tile to be displayed, calculate the geographic range a1 (WGS84 coordinate system) corresponding to the tile according to the WGS84 tile number.
[0167] 2. Calculate the tile number associated with the WGS84 tile in the BD09 biased Web Mercator coordinate system based on the WGS84 tile geographic extent a1.
[0168] For example, one WGS84 tile can be associated with nine BD09 biased Web Mercator tiles (abbreviated as BD09 tiles).
[0169] 3. Merge the associated BD09 tiles to generate a complete image S1.
[0170] 4. Automatically georeference image S1.
[0171] Exemplarily, the geographic coordinate information of the image S1 in the BD09 biased Web Mercator tile coordinate system (which may be referred to as the BD09 coordinate system) may be determined to obtain the image B1 with the geographic coordinate information.
[0172] 5. Calculate the spatial position C1 of each pixel in the WGS84 tile, and calculate the coordinate value C2 of the position C1 in the BD09 coordinate system. According to the coordinate value C2, get the pixel value corresponding to the coordinate value C2 in the registered image, and draw this pixel value to the pixel position corresponding to the WGS84 tile. Repeat this step until all 256*256 pixels are drawn, and the single tile conversion is completed.
[0173] The method provided by the present application is described above. The device provided by the present application is described below:
[0174] See also Figure 7 , is a structural diagram of a unified map tile access device provided in an embodiment of the present application, such as Figure 7 As shown, the unified map tile access device may include:
[0175] A determination unit is configured to determine a target specification map tile to be displayed according to a map range to be displayed and a current map level;
[0176] The conversion unit is configured to generate the target specification map tile for any target specification map tile according to the original specification map tile data by using a target conversion algorithm; wherein the target conversion algorithm is determined according to the target specification and the original specification, and is used to realize the conversion of the original specification map tile to the target specification map tile;
[0177] The display unit is configured to display the map according to the generated target specification map tiles.
[0178] In some embodiments, the conversion unit is specifically configured to determine the geographical scope corresponding to the target specification map tile based on the tile number of the target specification map tile; determine the original specification map tile associated with the target specification map tile based on the geographical scope corresponding to the target specification map tile and the association relationship between the geographical scope corresponding to the original specification map tile and the geographical scope corresponding to the target specification map tile; merge and generate an original specification map image based on the original specification map tile, and automatically geo-reference the original specification map image to obtain a map image with geographic coordinate information; generate the target specification map tile based on the geographical scope corresponding to the target specification map tile and the map image with geographic coordinate information.
[0179] In some embodiments, the original specification map tile uses encrypted geographic coordinates; the target specification map tile uses standard unencrypted geographic coordinates; or, the target specification map tile uses encrypted geographic coordinates; the original specification map tile uses standard unencrypted geographic coordinates;
[0180] The conversion unit is specifically configured to convert the geographical scope corresponding to the target specification map tile into the geographical scope in the original specification map tile coordinate system based on the association relationship between the geographical scope corresponding to the original specification map tile and the geographical scope corresponding to the target specification map tile; and determine the original specification map tile associated with the target specification map tile based on the geographical scope in the original specification map tile coordinate system.
[0181] In some embodiments, the conversion unit is specifically configured to determine the geographic coordinate information of the control points of the original map image in the original map tile coordinate system based on the pixel coordinates of the control points of the original map image; determine the geographic coordinate information of the control points of the original map image in the target map tile coordinate system based on the geographic coordinate information of the control points of the original map image in the original map tile coordinate system, and obtain a map image with geographic coordinate information.
[0182] In some embodiments, the conversion unit is specifically configured to crop a portion of an image with the same geographic scope from a map image with geographic coordinate information according to the geographic scope corresponding to the target specification map tile, to obtain a corresponding screenshot; and redraw the screenshot according to the size of the target specification map tile to obtain the target specification map tile.
[0183] In some embodiments, the conversion unit is specifically configured to determine the geographic coordinate information of the control points of the original specification map image in the original specification map tile coordinate system based on the pixel coordinates of the control points of the original specification map image, and obtain a map image with geographic coordinate information.
[0184] In some embodiments, the conversion unit is specifically configured to determine, for any pixel position in the target specification map tile, the geographic coordinate information of the pixel position in the original specification image coordinate system based on the geographic coordinate information of the pixel position; obtain the pixel value of the pixel position from the map image with the geographic coordinate information based on the geographic coordinate information of the pixel position in the original specification image coordinate system; and determine the pixel value as the pixel value of the pixel position of the target specification map tile.
[0185] See also Figure 8 , is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. The electronic device may include a processor 801, a communication interface 802, a memory 803 and a communication bus 804. The processor 801, the communication interface 802 and the memory 803 communicate with each other via the communication bus 804. Among them, the memory 803 stores a computer program; the processor 801 can execute the map tile access method described above by executing the program stored in the memory 803.
[0186] The memory 803 mentioned herein may be any electronic, magnetic, optical or other physical storage device that may contain or store information, such as executable instructions, data, etc. For example, the memory 803 may be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof.
[0187] The present application also provides a non-transitory machine-readable storage medium storing a computer program, such as Figure 8 The computer program may be provided by the memory 803 in the Figure 8 The processor 801 in the electronic device shown executes to implement the map tile access method described above.
[0188] The present application also provides a computer program stored in a non-transitory machine-readable storage medium, such as Figure 8 The memory 803 in the processor, and when the processor executes the computer program, it prompts the processor 801 to execute the map tile access method described above.
Claims
1. A unified map tile access method, characterized in that: include: Determine the target map tile to be displayed based on the map range to be displayed and the current map level; For any target specification map tile, the target specification map tile is generated by using a target tile conversion algorithm according to the original specification map tile data; wherein the target tile conversion algorithm is determined according to the target specification and the original specification, and is used to realize the conversion of the original specification map tile to the target specification map tile; Display the map according to the generated target specification map tiles; The method of generating the target specification map tile by using the target tile conversion algorithm based on the original specification map tile data includes: Determine the geographical range corresponding to the target specification map tile according to the tile number of the target specification map tile; Determine the original specification map tile associated with the target specification map tile according to the geographical range corresponding to the target specification map tile and the association relationship between the geographical range corresponding to the original specification map tile and the geographical range corresponding to the target specification map tile; Merging and generating an original specification map image based on the original specification map tiles, and automatically geo-registering the original specification map image to obtain a map image with geographic coordinate information; The target specification map tile is generated according to the geographical range corresponding to the target specification map tile and the map image with geographical coordinate information.
2. The method according to claim 1, characterized in that The original specification map tile uses encrypted geographic coordinates; the target specification map tile uses standard unencrypted geographic coordinates; or, the target specification map tile uses encrypted geographic coordinates; the original specification map tile uses standard unencrypted geographic coordinates; Determining the original specification map tile associated with the target specification map tile according to the geographical range corresponding to the target specification map tile and the association relationship between the geographical range corresponding to the original specification map tile and the geographical range corresponding to the target specification map tile includes: According to the association relationship between the geographical range corresponding to the original specification map tile and the geographical range corresponding to the target specification map tile, the geographical range corresponding to the target specification map tile is converted into the geographical range under the coordinate system of the original specification map tile; The original specification map tile associated with the target specification map tile is determined according to the geographic range in the original specification map tile coordinate system.
3. The method according to claim 1, characterized in that The automatic geo-registration of the original standard map image to obtain a map image with geographic coordinate information includes: Determine the geographic coordinate information of the control point of the original standard map image in the original standard map tile coordinate system according to the pixel coordinates of the control point of the original standard map image; According to the geographic coordinate information of the control points of the original specification map image in the original specification map tile coordinate system, the geographic coordinate information of the control points of the original specification map image in the target specification map tile coordinate system is determined to obtain a map image with geographic coordinate information.
4. The method according to claim 3, characterized in that The step of generating the target specification map tile according to the geographical range corresponding to the target specification map tile and the map image with geographical coordinate information includes: According to the geographic range corresponding to the target specification map tile, a portion of the image with the same geographic range is cropped from the map image with geographic coordinate information to obtain a corresponding screenshot; According to the size of the target specification map tile, the screenshot is redrawn to obtain the target specification map tile.
5. The method according to claim 1, characterized in that The automatic geo-registration of the original standard map image to obtain a map image with geographic coordinate information includes: According to the pixel coordinates of the control points of the original standard map image, the geographic coordinate information of the control points of the original standard map image in the original standard map tile coordinate system is determined to obtain a map image with geographic coordinate information.
6. The method according to claim 5, characterized in that The step of generating the target specification map tile according to the geographical range corresponding to the target specification map tile and the map image with geographical coordinate information includes: For any pixel position in the target specification map tile, determine the geographic coordinate information of the pixel position in the original specification image coordinate system according to the geographic coordinate information of the pixel position; According to the geographic coordinate information of the pixel position in the original standard image coordinate system, a pixel value of the pixel position is obtained from the map image with the geographic coordinate information; The pixel value is determined as the pixel value of the pixel position of the target specification map tile.
7. A unified map tile access device, characterized in that: include: A determination unit is configured to determine a target specification map tile to be displayed according to a map range to be displayed and a current map level; The conversion unit is configured to generate the target specification map tile for any target specification map tile according to the original specification map tile data by using the target tile conversion algorithm; wherein the target tile conversion algorithm is determined according to the target specification and the original specification, and is used to realize the conversion of the original specification map tile to the target specification map tile; A display unit, configured to display a map according to the generated target specification map tiles; Among them, the conversion unit is specifically configured to determine the geographical scope corresponding to the target specification map tile based on the tile number of the target specification map tile; determine the original specification map tile associated with the target specification map tile based on the geographical scope corresponding to the target specification map tile and the association relationship between the geographical scope corresponding to the original specification map tile and the geographical scope corresponding to the target specification map tile; merge and generate an original specification map image based on the original specification map tile, and automatically geo-reference the original specification map image to obtain a map image with geographic coordinate information; generate the target specification map tile based on the geographical scope corresponding to the target specification map tile and the map image with geographic coordinate information.
8. An electronic device, characterized in that: include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; A processor, configured to implement the method according to any one of claims 1 to 6 when executing a program stored in a memory.
9. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Point-to-point tile map dynamic projection method and device
CN104134187A