Method for loading OGC standard service in WeChat applet
By using Leaflet to load the street view base map and requesting OGC standard services in the WeChat applet, the problem of loading and displaying OGC standard services in the WeChat applet is solved, and efficient and convenient access to GIS data is achieved.
Patent Information
- Application Number
- CN202411457347.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-02-14
AI Technical Summary
The prior art is difficult to efficiently load and display OGC standard services in WeChat applets, resulting in users not being able to easily access GIS data on mobile devices.
The street view base map is loaded through the tileLayer() method of Leaflet, and the OGC standard service is requested from the GeoServer server using the tileLayer.wms() method of Leaflet, and displayed on the street view base map. At the same time, user interaction functions are implemented, such as transparency settings and attribute information acquisition.
It realizes the rapid loading and display of OGC standard services in WeChat applets, reducing the software development cycle and cost, and providing a convenient and efficient GIS data access experience.
Smart Images

Figure CN119440658A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for loading OGC standard services in a WeChat applet, which is applicable to the field of GIS data loading. Background Art
[0002] At present, the main method is to develop a program on the computer to load the OGC standard service, and provide users with functions such as viewing, managing, marking, and combining layers in a visual way. Clicking points on the layer can obtain the attribute information of the corresponding location.
[0003] With the continuous development of mobile Internet, more and more work has begun to shift from computers to mobile devices. Users hope to get the information they need immediately on mobile devices to meet their mobile office needs anytime and anywhere.
[0004] As an emerging mobile application platform, WeChat Mini Programs have the characteristics of low resource consumption, convenient use, rich functions, user sharing, and wide use, and have been adopted and recognized by a large number of users. Redeveloping a program to load OGC standard services for WeChat Mini Programs requires a long software development cycle. Summary of the invention
[0005] The technical problem to be solved by the present invention is: in view of the above-mentioned problems, a method for loading OGC standard services in a WeChat applet is provided.
[0006] The technical solution adopted by the present invention is: a method for loading OGC standard services in a WeChat applet, characterized by comprising:
[0007] Use Leaflet's tileLayer() method to load the street view basemap in the specified area of the WeChat applet display page;
[0008] Through Leaflet's tileLayer.wms() method, the OGC standard service of the corresponding layer is requested from the GeoServer server and loaded and displayed on the street view base map.
[0009] The method of using the tileLayer.wms() method of Leaflet to request the OGC standard service of the corresponding layer from the GeoServer server to load and display it on the street view base map includes:
[0010] Pass the address of the OGC standard service into the tileLayer.wms() method, and request the OGC standard service from the GeoServer server through the tileLayer.wms() method;
[0011] By passing the latitude and longitude parameters into Leaflet's setView() method, the requested data will be displayed at the specific coordinates on the street view base map.
[0012] A WeChat applet interaction method, characterized by comprising:
[0013] Use Leaflet's tileLayer() method to load the street view basemap in the specified area of the WeChat applet display page;
[0014] Get at least one target layer display button clicked by the user, and based on the target layer corresponding to the button, request the OGC standard service of the corresponding layer from the GeoServer server through the tileLayer.wms() method of Leaflet to load and display it on the street view base map.
[0015] Also includes:
[0016] Get the transparency setting button clicked by the user, and set the transparency of the target layer through Leaflet's setOpacity() method.
[0017] Also includes:
[0018] Get the latitude and longitude information of the user's click location and the current screen location information;
[0019] Based on the latitude and longitude information of the clicked location, the current screen location information and the layer information loaded and displayed on the street view base map, the OGC standard service address of the corresponding layer is requested through ajax to obtain the attribute information of the clicked location;
[0020] The attribute information of the clicked position is displayed in the designated area of the WeChat applet display page.
[0021] The method of obtaining at least one target layer display button clicked by the user, and requesting the OGC standard service of the corresponding layer from the GeoServer server through the tileLayer.wms() method of Leaflet based on the target layer corresponding to the button to load and display it on the street view base map includes:
[0022] Pass the address of the OGC standard service into the tileLayer.wms() method, and request the OGC standard service from the GeoServer server through the tileLayer.wms() method;
[0023] By passing the latitude and longitude parameters into Leaflet's setView() method, the requested data will be displayed at the specific coordinates on the street view base map.
[0024] A WeChat applet interaction device, characterized by comprising:
[0025] Loading basemap module, used to load the street view basemap in the specified area of the WeChat applet display page through Leaflet's tileLayer() method;
[0026] The OGC standard service module is used to obtain at least one target layer display button clicked by the user, and based on the target layer corresponding to the button, request the OGC standard service of the corresponding layer from the GeoServer server through the tileLayer.wms() method of Leaflet to load and display it on the street view base map.
[0027] A storage medium stores a computer program executable by a processor, wherein the computer program implements the steps of the method when executed.
[0028] An electronic device comprises a memory and a processor, wherein the memory stores a computer program executable by the processor, and is characterized in that the steps of the method are implemented when the computer program is executed.
[0029] The beneficial effects of the present invention are as follows: the present invention loads a street view base map in a designated area of a WeChat applet display page through the tileLayer() method of Leaflet; requests the OGC standard service of the corresponding layer from a GeoServer server through the tileLayer.wms() method of Leaflet to load and display it on the street view base map, and combines the WeChat applet with the existing program loaded on the computer side, so as to reduce the software development cycle and cost while providing users with a new, convenient and efficient use experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 This is a flow chart of Example 1.
[0031] Figure 2 This is a schematic diagram of loading OGC standard services in Example 1.
[0032] Figure 3 This is a schematic diagram of an interface with a target layer display button in Example 2.
[0033] Figure 4 This is a schematic diagram of the interface display of attribute information in Example 2.
[0034] Figure 5 This is the online deployment flow chart of Example 3. DETAILED DESCRIPTION
[0035] Embodiment 1: as Figure 1 As shown, this embodiment is a method for loading OGC standard services in a WeChat applet, which specifically includes the following steps:
[0036] S1. Use the tileLayer() method of Leaflet to load the Amap street view basemap in the specified area of the WeChat applet display page.
[0037] S2. Use Leaflet's tileLayer.wms() method to request the OGC standard service of the corresponding layer from the GeoServer server and load it onto the street view base map (see Figure 2 ).
[0038] S2-1. Pass the address of the OGC standard service into the tileLayer.wms() method and request the OGC standard service from the GeoServer server through the tileLayer.wms() method.
[0039] S2-2. By passing the latitude and longitude parameters in Leaflet's setView() method, the requested data will be displayed at the specific coordinates on the street view base map.
[0040] Embodiment 2: This embodiment is a WeChat applet interaction method, which specifically includes the following steps:
[0041] A. Use the tileLayer() method of Leaflet to load the Amap street view basemap in the specified area of the WeChat applet display page.
[0042] B. Get the target layer display button clicked by the user, and based on the target layer corresponding to the button, request the OGC standard service of the corresponding layer from the GeoServer server through Leaflet's tileLayer.wms() method to load and display it on the street view base map.
[0043] In this example, the tileLayer.wms() method of Leaflet is used to request the OGC standard service of the corresponding layer from the GeoServer server and load it into the street view base map, including:
[0044] Pass the address of the OGC standard service into the tileLayer.wms() method, and request the OGC standard service from the GeoServer server through the tileLayer.wms() method;
[0045] By passing the latitude and longitude parameters into Leaflet's setView() method, the requested data will be displayed at the specific coordinates on the street view base map.
[0046] In this embodiment, after the user clicks the layer button, the WeChat applet displays the layer operation interface on the right side of the street view base map. The layer operation interface has multiple target layer information and corresponding display buttons (see Figure 3 ).
[0047] After the user clicks the target layer display button, the WeChat applet requests the OGC standard service of the corresponding layer from the GeoServer server through Leaflet's tileLayer.wms() method based on the target layer corresponding to the button, and loads it onto the street view base map.
[0048] In this embodiment, the user can click display buttons of multiple target layers to display multiple target layers on the Amap street view base map.
[0049] C. Get the latitude and longitude information of the user's click location and the current screen location information.
[0050] D. Based on the latitude and longitude information of the clicked location, the current screen location information, and the layer information loaded and displayed on the street view base map, the OGC standard service address of the corresponding layer is requested through ajax to obtain the attribute information of the clicked location.
[0051] E. Display the attribute information of the clicked position in the specified area of the WeChat applet display page (see Figure 4 ).
[0052] Embodiment 3: This embodiment is a WeChat applet interaction device, including: loading base map module and OGC standard service module, etc.
[0053] In this embodiment, the base map loading module is used to load the street view base map in the specified area of the WeChat applet display page through the tileLayer() method of Leaflet; the OGC standard service module is used to obtain at least one target layer display button clicked by the user, and based on the target layer corresponding to the button, request the OGC standard service of the corresponding layer from the GeoServer server through the tileLayer.wms() method of Leaflet to load and display it on the street view base map.
[0054] In this embodiment, the WeChat applet interactive device project is deployed to the online server by mirror deployment, specifically:
[0055] Package the basemap loading module and OGC standard service module into a mirror locally;
[0056] Push the image to the remote image repository;
[0057] Pull the image from the image repository on the online server (such as Figure 5 shown).
[0058] In this embodiment, when the program is loaded, the address in the online server is loaded into the WeChat applet through Webview.
[0059] Embodiment 4: This embodiment is a storage medium on which a computer program that can be executed by a processor is stored. When the computer program is executed, the steps of the method for loading OGC standard services in a WeChat applet in Embodiment 1 are implemented.
[0060] Embodiment 5: This embodiment is a storage medium on which a computer program that can be executed by a processor is stored. When the computer program is executed, the steps of the WeChat applet interaction method in Embodiment 2 are implemented.
[0061] Embodiment 6: This embodiment is an electronic device having a memory and a processor. The memory stores a computer program that can be executed by the processor. When the computer program is executed, the steps of the method for loading OGC standard services in a WeChat applet in Embodiment 1 are implemented.
[0062] Embodiment 7: This embodiment is an electronic device having a memory and a processor. The memory stores a computer program that can be executed by the processor. When the computer program is executed, the steps of the WeChat applet interaction method in Embodiment 2 are implemented.
[0063] The technical terms used in the present invention are described below:
[0064] GeoServer server: can easily publish map data in most mainstream formats, allowing users to update, delete, and insert feature data.
[0065] Leaflet: is an open source and mobile-friendly interactive map JavaScript library.
[0066] WeChat Mini Program: WeChat Mini Program uses WeChat as a carrier and can be easily obtained and spread within WeChat.
[0067] OGC: Open Geospatial Consortium, which has developed a series of standards for data and services.
[0068] Mirror: It is a form of file storage. The data on one disk has an identical copy on another disk.
Claims
1. A method for loading OGC standard services in a WeChat applet, characterized in that: include: Use Leaflet's ti leLayer() method to load the street view basemap in the specified area of the WeChat applet display page; Through Leaflet's ti leLayer.wms() method, the OGC standard service of the corresponding layer is requested from the GeoServer server and loaded and displayed on the street view base map.
2. The method for loading OGC standard services in a WeChat applet according to claim 1, characterized in that: The method of requesting the OGC standard service of the corresponding layer from the GeoServer server through the Leaflet layerLayer.wms() method to load and display it on the street view base map includes: Pass the address of the OGC standard service into the ti leLayer.wms() method, and request the OGC standard service from the GeoServer server through the ti leLayer.wms() method; By passing the latitude and longitude parameters into Leaflet's setView() method, the requested data will be displayed at the specific coordinates on the street view base map.
3. A WeChat applet interaction method, characterized in that: include: Use Leaflet's ti leLayer() method to load the street view basemap in the specified area of the WeChat applet display page; Get at least one target layer display button clicked by the user, and based on the target layer corresponding to the button, request the OGC standard service of the corresponding layer from the GeoServer server through the ti leLayer.wms() method of Leaflet to load and display it on the street view base map.
4. The WeChat applet interaction method according to claim 3, characterized in that: Also includes: Get the transparency setting button clicked by the user, and set the transparency of the target layer through Leaflet's setOpacity() method.
5. The WeChat applet interaction method according to claim 3, characterized in that: Also includes: Get the latitude and longitude information of the user's click location and the current screen location information; Based on the latitude and longitude information of the clicked location, the current screen location information and the layer information loaded and displayed on the street view base map, the OGC standard service address of the corresponding layer is requested through ajax to obtain the attribute information of the clicked location; The attribute information of the clicked position is displayed in the designated area of the WeChat applet display page.
6. The WeChat applet interaction method according to claim 3, characterized in that: The step of obtaining at least one target layer display button clicked by the user, and requesting the OGC standard service of the corresponding layer from the GeoServer server through the ti leLayer.wms() method of Leaflet based on the target layer corresponding to the button to load and display it on the street view base map includes: Pass the address of the OGC standard service into the ti leLayer.wms() method, and request the OGC standard service from the GeoServer server through the ti leLayer.wms() method; By passing the latitude and longitude parameters into Leaflet's setView() method, the requested data will be displayed at the specific coordinates on the street view base map.
7. A WeChat applet interactive device, characterized in that: include: Loading basemap module, used to load the street view basemap in the specified area of the WeChat applet display page through Leaflet's ti leLayer() method; The OGC standard service module is used to obtain at least one target layer display button clicked by the user, and based on the target layer corresponding to the button, request the OGC standard service of the corresponding layer from the GeoServer server through the Leaflet ti leLayer.wms() method to load and display it on the street view base map.
8. A storage medium having stored thereon a computer program executable by a processor, characterized in that: When the computer program is executed, the steps of the method according to any one of claims 1 to 6 are implemented.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program executable by the processor, wherein: When the computer program is executed, the steps of the method according to any one of claims 1 to 6 are implemented.