An OpenJump-based Web Mercator projection map tile display implementation method and device

By using a Web Mercator projection map tile display method based on OpenJump, the management challenges of data format and coordinate transformation in power grid GIS were solved, enabling efficient editing of high-resolution geographic base maps, improving project implementation efficiency and reducing labor costs.

CN116226562BActive Publication Date: 2026-04-14NARI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-02
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In power grid GIS, existing technologies struggle to effectively manage diverse data formats and coordinate transformations, resulting in low project implementation efficiency and high labor costs.

Method used

It adopts a Web Mercator projection map tile display method based on OpenJump. By obtaining the tile layer configuration information, calculating the tile code and coordinates, and combining the pixel size and scale, it can accurately draw the tiles in the window and supports editing of high-resolution geographic base maps.

Benefits of technology

It improved the efficiency of power GIS engineering implementation, saved labor costs, and met the editing needs of high-resolution geographic base maps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116226562B_ABST
    Figure CN116226562B_ABST
Patent Text Reader

Abstract

The application discloses an OpenJump-based Web Mercator projection map tile display implementation method and device, and the method comprises the following steps: acquiring tile layer configuration information; initializing a tile layer on a window based on the tile layer configuration information; calculating the row and column codes of the tile corresponding to a center point according to the longitude and latitude coordinates and the initial scale of the center point; calculating the row and column codes of the tile above the center tile and the tile in the clockwise direction according to the row and column codes of the tile corresponding to the center point; calculating the longitude and latitude coordinates and the pixel coordinates of the tile above the center tile and the tile in the clockwise direction based on the calculation rules of the Web Mercator projection; acquiring a tile file according to the row and column codes of the tile, and drawing the tile in the corresponding pixel position in the window according to the pixel coordinates of the tile, so that the demand of editing vector data with reference to high-definition resolution geographic base maps in power GIS is met, the efficiency of engineering implementation is improved, and the human cost in engineering implementation is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method and apparatus for displaying Web Mercator projection map tiles based on OpenJump, belonging to the field of intelligent power GIS technology. Background Technology

[0002] Geographic base maps and power grid spatial data are important components of power grid GIS. Most power grid GIS focuses on providing functions such as browsing the spatial distribution of the power grid and visualizing power grid operation information. In the construction of the system, the diverse data sources often require the conversion and unification of formats and coordinates. The sorting and standardization of vector data is a relatively heavy task. Summary of the Invention

[0003] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and device for displaying Web Mercator projection map tiles based on OpenJump, which meets the needs of editing vector data with reference to high-resolution geographic base maps in power GIS, improves the efficiency of engineering implementation, and saves manpower costs in engineering implementation.

[0004] To achieve the above objectives, the present invention is implemented using the following technical solution:

[0005] In a first aspect, the present invention provides a method for displaying Web Mercator projection map tiles based on OpenJump, including:

[0006] Obtain tile layer configuration information, including the latitude and longitude coordinates of the screen center point and the initial scale;

[0007] Initialize the tile layer on the window based on the tile layer configuration information;

[0008] Calculate the row and column codes of the tiles corresponding to the center point based on the latitude and longitude coordinates of the screen center point and the initial scale.

[0009] Calculate the row and column codes of the tiles above the center tile and the tiles in the clockwise direction based on the row and column codes of the tile corresponding to the center tile;

[0010] Based on the calculation rules of Web Mercator projection, calculate the latitude and longitude coordinates of the tiles above the center tile and the tiles in the clockwise direction;

[0011] By combining the tile pixel size and the spatial resolution corresponding to different scales, the latitude and longitude coordinates of each tile are converted into pixel coordinates;

[0012] The tile file is obtained based on the row and column encoding of the tile, and the tile is drawn on the corresponding pixel position in the window according to the pixel coordinates of the tile.

[0013] Furthermore, the layer configuration information also includes the tile folder access address, tile file image format, and custom layer name.

[0014] Furthermore, the tile file is obtained based on the row and column encoding of the tile, and the tile is drawn on the corresponding pixel position in the window according to the pixel coordinates of the tile, including:

[0015] Calculate the total number of tiles needed to display the entire screen based on the screen area and the initial scale.

[0016] The tile file is obtained based on the row and column codes of the tiles. Starting from the tile above the center tile, the tiles are drawn in a clockwise direction until the number of tiles drawn meets the total number of tiles required to fill the current screen.

[0017] Furthermore, the tile files are deployed on the server according to the encoding rule of "scale Z / column number x / row number y" for the tile layers to call.

[0018] Secondly, the present invention provides a Web Mercator projection map tile display implementation device based on OpenJump, comprising:

[0019] The acquisition module is used to acquire tile layer configuration information, including the latitude and longitude coordinates of the screen center point and the initial scale.

[0020] An initialization module is used to initialize a tile layer on the window based on the tile layer configuration information;

[0021] The first calculation module is used to calculate the row and column codes of the tiles corresponding to the center point based on the latitude and longitude coordinates of the center point of the screen and the initial scale.

[0022] The second calculation module is used to calculate the row and column codes of the tiles above the center tile and the tiles in the clockwise direction based on the row and column codes of the tile corresponding to the center point.

[0023] The third calculation module is used to calculate the latitude and longitude coordinates of the tiles above the center tile and the tiles in the clockwise direction based on the calculation rules of Web Mercator projection.

[0024] The coordinate transformation module is used to convert the latitude and longitude coordinates of each tile into pixel coordinates by combining the tile pixel size and the spatial resolution corresponding to different scales.

[0025] The drawing module is used to obtain the tile file according to the row and column encoding of the tile, and draw the tile on the corresponding pixel position in the window according to the pixel coordinates of the tile.

[0026] Furthermore, the layer configuration information in the acquisition module also includes the tile folder access address, tile file image format, and custom layer name.

[0027] Furthermore, the drawing module includes a tile count calculation unit and a drawing unit, wherein:

[0028] The total number of tiles calculation unit is used to calculate the total number of tiles required to display the entire screen based on the screen range and the initial scale.

[0029] The drawing unit is used to obtain the tile file according to the row and column codes of the tile, start drawing from the tile above the center tile, and draw the tiles in a clockwise direction after the upper tile is drawn, until the number of drawn tiles meets the total number of tiles required to fill the current screen.

[0030] Furthermore, it also includes a tile file deployment module, which is used to deploy the tile files on the server according to the encoding rule of "scale Z / column number x / row number y" level by level, so that the tile layers can call them.

[0031] Thirdly, the present invention provides an electronic device, including a processor and a storage medium;

[0032] The storage medium is used to store instructions;

[0033] The processor is configured to operate according to the instructions to perform the steps of the method according to any of the preceding claims.

[0034] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the preceding methods.

[0035] Compared with the prior art, the beneficial effects achieved by the present invention are as follows:

[0036] This invention provides a method and apparatus for displaying Web Mercator projection map tiles based on OpenJump. By displaying Web Mercator projection map tiles in OpenJump, it effectively combines the widely used Web Mercator projection map tiles with an image pyramid structure and the GIS software OpenJump with rich editing functions. This meets the needs of power GIS for editing vector data with reference to high-resolution geographic base maps, improves the efficiency of engineering implementation, and saves manpower costs in engineering implementation. Attached Figure Description

[0037] Figure 1 This is a flowchart of a Web Mercator projection map tile display method based on OpenJump provided in an embodiment of the present invention. Detailed Implementation

[0038] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.

[0039] Example 1

[0040] This embodiment describes a method for displaying Web Mercator projection map tiles based on OpenJump, including:

[0041] Obtain tile layer configuration information, including the latitude and longitude coordinates of the screen center point and the initial scale;

[0042] Initialize the tile layer on the window based on the tile layer configuration information;

[0043] Calculate the row and column codes of the tiles corresponding to the center point based on the latitude and longitude coordinates of the screen center point and the initial scale.

[0044] Calculate the row and column codes of the tiles above the center tile and the tiles in the clockwise direction based on the row and column codes of the tile corresponding to the center tile;

[0045] Based on the calculation rules of Web Mercator projection, calculate the latitude and longitude coordinates of the tiles above the center tile and the tiles in the clockwise direction;

[0046] By combining the tile pixel size and the spatial resolution corresponding to different scales, the latitude and longitude coordinates of each tile are converted into pixel coordinates;

[0047] The tile file is obtained based on the row and column encoding of the tile, and the tile is drawn on the corresponding pixel position in the window according to the pixel coordinates of the tile.

[0048] like Figure 1 As shown in the figure, the implementation method of Web Mercator projection map tile display based on OpenJump provided in this embodiment involves the following steps in its application process:

[0049] S1: Tile files are organized according to the image pyramid structure and deployed on the server level by level according to the encoding rule of "scale Z / column number x / row number y". An HTTP access path is provided. Tile files include JPG and PNG formats. Generally, image map tile files are in JPG format, while administrative division map tile files are in PNG format.

[0050] S2: This implementation method and device provides an executable program in the form of a jar package. The jar package is deployed in the lib / ext directory of the OpenJump executable program directory. After confirming that the JDK 1.8 environment is available, the OpenJump program is run.

[0051] S3: In the OpenJump main interface, open the menu item for loading map tiles. A tile layer configuration window will pop up. Follow the prompts to enter the tile folder URL, tile file image format (JPG or PNG), custom layer name, initialize the coordinates of the view center point, and initialize the scale bar.

[0052] S4: Custom plugin starts, and the tile layer is initialized in execute. The tile layer inherits from the GeoReferencedLayerable class of geographic coordinate layer. The coordinate system parameter of the tile layer is defined as "ESPG:3857". The corresponding attribute items of the tile layer instance are initialized using the variable values ​​entered in the configuration window.

[0053] S5: Obtain the LayerManager property instance of the currently running WorkbenchContext instance of OpenJump, register the tile layer in the LayerManager, add the layer to the LayerNamePanel in the layer management tree, and call the static method setRendererFactory of RenderingManager in the OpenJump API to register the tile layer rendering method.

[0054] S6: Based on the spatial resolution and latitude-longitude to projection coordinate transformation calculation rules corresponding to different scales in Web Mercator projection, the latitude-longitude range of the layer view in S3 is converted into the projection coordinate range. Combined with the encoding rules of scale / row number / column number of Web Mercator projection image pyramid, the tile row and column number of the initial view center point position is calculated.

[0055] S7: Calculate the number of map tile rows and columns needed to fill the screen based on the pixel size of the LayerViewPanel view window, and obtain the total number of display tiles;

[0056] S6: Based on the calculation rules of Web Mercator projection, realize the conversion between latitude and longitude coordinates and projection coordinates under different scales / spatial resolutions. Combine the tile pixel size and the spatial resolution corresponding to different scales to realize the conversion between latitude and longitude and pixel coordinates. Combine the encoding rules of scale / row number / column number of Web Mercator projection image pyramid to realize the tile encoding calculation corresponding to the center point under the current scale view.

[0057] S7: Calculate the number of map tile rows and columns needed to fill the screen at the current scale based on the pixel size of the LayerViewPanel view window, and get the total number of display tiles;

[0058] S8: Starting from the tile above the center tile, based on the tile text encoding and splicing rules, and the tile file pixel size, the column number of the upper tile remains unchanged and the row number is reduced by 1 based on the row and column number of the center tile. The pixel coordinates x and y coordinates are reduced by 256 pixels. The image file is obtained according to the encoding and drawn according to the pixel position.

[0059] S9: After locating the top tile, follow the clockwise order and the same calculation and drawing rules as the tiles above the center tile to acquire and draw other tiles until the number of drawn tiles meets the total number of tiles required to fill the current screen.

[0060] Example 2

[0061] This embodiment provides a Web Mercator projection map tile display implementation device based on OpenJump, including:

[0062] The acquisition module is used to acquire tile layer configuration information, including the latitude and longitude coordinates of the screen center point and the initial scale.

[0063] An initialization module is used to initialize a tile layer on the window based on the tile layer configuration information;

[0064] The first calculation module is used to calculate the row and column codes of the tiles corresponding to the center point based on the latitude and longitude coordinates of the center point of the screen and the initial scale.

[0065] The second calculation module is used to calculate the row and column codes of the tiles above the center tile and the tiles in the clockwise direction based on the row and column codes of the tile corresponding to the center point.

[0066] The third calculation module is used to calculate the latitude and longitude coordinates of the tiles above the center tile and the tiles in the clockwise direction based on the calculation rules of Web Mercator projection.

[0067] The coordinate transformation module is used to convert the latitude and longitude coordinates of each tile into pixel coordinates by combining the tile pixel size and the spatial resolution corresponding to different scales.

[0068] The drawing module is used to obtain the tile file according to the row and column encoding of the tile, and draw the tile on the corresponding pixel position in the window according to the pixel coordinates of the tile.

[0069] Specifically, the layer configuration information in the acquisition module also includes the tile folder access address, tile file image format, and custom layer name.

[0070] Specifically, the drawing module includes a tile count calculation unit and a drawing unit, wherein:

[0071] The total number of tiles calculation unit is used to calculate the total number of tiles required to display the entire screen based on the screen range and the initial scale.

[0072] The drawing unit is used to obtain the tile file according to the row and column codes of the tile, start drawing from the tile above the center tile, and draw the tiles in a clockwise direction after the upper tile is drawn, until the number of drawn tiles meets the total number of tiles required to fill the current screen.

[0073] Specifically, it also includes a tile file deployment module, which is used to deploy the tile files on the server according to the encoding rule of "scale Z / column number x / row number y" level by level, so that the tile layers can call them.

[0074] Example 3

[0075] This embodiment provides an electronic device, including a processor and a storage medium;

[0076] The storage medium is used to store instructions;

[0077] The processor is configured to operate according to the instructions to perform the steps of the method according to any one of Embodiment 1.

[0078] Example 4

[0079] This embodiment provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described in Embodiment 1.

[0080] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for displaying Web Mercator projection map tiles based on OpenJump, characterized in that, include: Obtain tile layer configuration information, including the latitude and longitude coordinates of the screen center point and the initial scale; Initialize the tile layer on the window based on the tile layer configuration information; Calculate the row and column codes of the tiles corresponding to the center point based on the latitude and longitude coordinates of the screen center point and the initial scale. Calculate the row and column codes of the tiles above the center tile and the tiles in the clockwise direction based on the row and column codes of the tile corresponding to the center tile; Based on the calculation rules of Web Mercator projection, calculate the latitude and longitude coordinates of the tiles above the center tile and the tiles in the clockwise direction; By combining the tile pixel size and the spatial resolution corresponding to different scales, the latitude and longitude coordinates of each tile are converted into pixel coordinates; The tile file is obtained based on the row and column encoding of the tile, and the tile is drawn on the corresponding pixel position in the window according to the pixel coordinates of the tile; including: Calculate the total number of tiles needed to display the entire screen based on the screen area and the initial scale. The tile file is obtained according to the row and column codes of the tiles. Starting from the tile above the center tile, the tiles are drawn. After the top tile is drawn, the tiles are drawn in a clockwise direction until the number of tiles drawn meets the total number of tiles required to fill the current screen. The tile files are deployed on the server according to the encoding rule of "scale Z / column number x / row number y" for the tile layers to call.

2. The method for displaying Web Mercator projection map tiles based on OpenJump according to claim 1, characterized in that, The tile layer configuration information also includes the tile folder access address, tile file image format, and custom layer name.

3. A device for displaying Web Mercator projection map tiles based on OpenJump, characterized in that, include: The acquisition module is used to acquire tile layer configuration information, including the latitude and longitude coordinates of the screen center point and the initial scale. An initialization module is used to initialize a tile layer on the window based on the tile layer configuration information; The first calculation module is used to calculate the row and column codes of the tiles corresponding to the center point based on the latitude and longitude coordinates of the center point of the screen and the initial scale. The second calculation module is used to calculate the row and column codes of the tiles above the center tile and the tiles in the clockwise direction based on the row and column codes of the tile corresponding to the center point. The third calculation module is used to calculate the latitude and longitude coordinates of the tiles above the center tile and the tiles in the clockwise direction based on the calculation rules of Web Mercator projection. The coordinate transformation module is used to convert the latitude and longitude coordinates of each tile into pixel coordinates by combining the tile pixel size and the spatial resolution corresponding to different scales. The drawing module is used to obtain the tile file according to the row and column encoding of the tile, and draw the tile on the corresponding pixel position in the window according to the pixel coordinates of the tile; The drawing module includes a tile count calculation unit and a drawing unit, wherein: The total number of tiles calculation unit is used to calculate the total number of tiles required to display the entire screen based on the screen range and the initial scale. The drawing unit is used to obtain the tile file according to the row and column codes of the tile, start drawing from the tile above the center tile, and draw the tiles in a clockwise direction after the upper tile is drawn, until the number of drawn tiles meets the total number of tiles required to fill the current screen. It also includes a tile file deployment module, which is used to deploy the tile files on the server according to the encoding rule of "scale Z / column number x / row number y" level by level, so that the tile layers can call them.

4. The device for displaying Web Mercator projection map tiles based on OpenJump according to claim 3, characterized in that, The acquisition module also includes tile layer configuration information such as tile folder access address, tile file image format, and custom layer name.

5. An electronic device, characterized in that: Including processor and storage media; The storage medium is used to store instructions; The processor is configured to operate according to the instructions to perform the steps of the method according to any one of claims 1 to 2.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When executed by a processor, the program implements the steps of the method described in any one of claims 1 to 2.

Citation Information

Patent Citations

  • Map drawing method based on tile map

    CN111078814A

  • Systems and methods for dynamically providing scale information on a digital map

    US20180357779A1