Tag Archives: API

LabVIEW uses Baidu map API and reports an error. The getcontext method is undefined

A question that has been perplexed for a long time. In a comment on a post, a great God answered the question:

Add this to the code: & lt; meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

welcome to leave a message so that the people behind can solve the problem faster! In addition, you are welcome to pay attention to my WeChat official account, so that you can use the fragmented time to communicate with each other. Encourage each other

Method of loading satellite map in Intranet Based on Google map offline API source code

Why are there a series of technical challenges behind “OMG buy it”>>>

1. Overview

We have previously shared with you the methods of offline loading satellite images on the open source platform of 3D Earth, mainly including the LAN offline loading of osgeearth open source 3D Earth Based on desktop and cesium open source 3D Earth Based on Web

In addition, I also shared with you the methods of offline loading satellite images on the two-dimensional open source platform, mainly including the specific operation methods of offline deployment of Intranet WebGIS based on openlayers and offline deployment of Intranet WebGIS based on mapbox

Today, we will share with you how to load satellite map in Intranet Based on Google map offline API

2. Preparation

Before starting, we need to prepare offline data publishing software, offline satellite image sample data, Google map offline API development source code and local IP address

map publishing software: if you need to publish offline satellite images on the intranet, please make sure that the middleware version of map publishing service is above 4.0.6. If the version is lower than 4.0.6, please reply “middleware” via private message to get the latest version of the installation package for free, or you can download it directly from the official website of shuijingzhu

offline sample data: the offline sample data provided in this paper include satellite image and place name label data of Mercator projection and WGS84 projection. As this is mainly for functional demonstration, only the top 10 image data are prompted

Satellite image sample data

Sample data can be obtained by replying to the private message and replying to “sample data”

Google map offline API source code: Google map offline API is different from openlayers and mapbox. Google official website does not provide Google map source code development kit that can be downloaded directly

Therefore, the source code file of Google map API development kit provided here is downloaded from the official website by technicians

Now, you just need to reply through private message and reply to “Google map API” to get the offline API source file of Google map

local IP address: since the local IP is used as the access address, you can obtain the local IP address for standby by running the “ipconfig” command in the DOS window or other ways, as shown in the figure below

Get local IP address

3. Off line release of Mercator projection satellite images

For the software installation and offline satellite image publishing method, please refer to the article “official release of global satellite image offline publishing artifact” middleware 4.0 for water channel annotation map publishing service “

Since Google map API is a two-dimensional application, there is no need to publish elevation DEM data here

However, it should be noted that the released satellite images and projection settings must be unified, and the port number is not occupied by other programs, as shown in the figure below

Installation configuration

After the installation, the following information will be displayed

Installation complete

Open the windows task manager. If the status of weserver service shows “running”, it means that the middleware service has been installed successfully and is running normally, as shown in the figure below

The service is running normally

After ensuring that the service runs correctly, you can open the label tile address of “Z = 7/y = 48/x = 105” in the browser to check the published results. The example address is as follows:

http://192.168.0.10 :8519/WeServer/wmts/1.0.0/acimage/default/mercator/7/48/105.jpg

Note: the IP and port number in the above URL address should be consistent with the configuration in weserver

If there is no abnormality, the satellite image tiles of Beijing area will be displayed, as shown in the figure below

Satellite image tiles

Similarly, you can also check the published results by opening the tile address of the place name label “Z = 7/y = 48/x = 105” in the local browser. The example address is as follows:

http://192.168.0.10 :8519/WeServer/wmts/1.0.0/aclabel/default/mercator/7/48/105.png

Note: the IP and port number in the above URL address should be consistent with the configuration in weserver

If there is no exception, the result of place name label will be displayed, as shown in the figure below

Tile of place name label

Turn on the tile grid display function in the micrograph, we can see the tile “Z = 7/y = 48/x = 105” above, and the corresponding tile in the micrograph is “Z = 8/x = 49/y = 106”

That is to say, tile numbers in the micrograph software start from 1, so the row and column numbers will be 1 larger than weserver, and the display order of tile numbers is ZXY, while the release order of weserver is ZYX. If you understand their differences, it will help you to debug when calling tiles released by weserver

Tile number in micrograph

4. Deploy Google map offline API source website

The above has explained how to publish offline satellite images and test the published results on the intranet through weserver. Now let’s talk about the method of deploying Google map offline API source code

If you haven’t got the source code of Google map offline API, just reply to “Google map API” through private letter to get the source code file of Google map offline API

Google map source code after decompression, as shown in the figure below

Google map offline API source directory

In the source code file, you need to change the IP address and port number in the “Google mapsample. HTML” file to the local IP address and the port number set when publishing offline satellite images in weserver, as shown in the figure below

Modify IP and port number

Next, we need to publish the Google map offline API source code into a website through IIS

Open “management tools” in Windows control panel, as shown in the figure below

Management tools

Open IIS website manager, as shown in the figure below

Open IIS

Right click the “website” tree node, and then select the “add website” menu, as shown in the figure below

Add site

The website name can be taken at will. Here we call it “Google map”. The physical path is where the offline API source code of Google map is located, and the port number is set to the default value of “80”, as shown in the figure below

Configure site parameters

After the configuration, click the “OK” button to complete the website configuration, as shown in the figure below

Complete the configuration

Now, you only need to visit the published website page in the browser to browse the satellite images offline. The website address is as follows:

http://192.168.0.10/GoogleMapSample.html

Note: you need to change the IP in the above address to the local IP. If it is not port 80 when publishing the website, you also need to add the port number

If everything is normal, you can see the satellite image map released offline in the LAN, as shown in the figure below

Offline image loading effect

So far, a WebGIS basic system based on Google map offline API source code to load satellite map in Intranet is completed. You can carry out secondary development according to your own needs and add your own business functions

5. How to consult Google map API development documents

Google map has many functions. We can open the official website through the following address

https://developers.google.cn/maps/documentation

Click “maps JavaScript API” in the open page to view the relevant API documents, as shown in the figure below

Google map official document

The official website provides many samples and API detailed documents, as shown in the figure below

Google map official API

As a developer, it should be a basic skill to query English documents. However, if you feel that pure English is a little difficult, you can open it through Google browsing, and then click “Chinese (Simplified)” to automatically translate the page content into Chinese, as shown in the figure below

Looking up Chinese documents

6. Summary

The above is based on the Google map offline API source code in the intranet to load all the satellite map description, including the offline satellite image intranet release, Google offline API source code release and help document access and other content

Finally, the data provided in this paper are sample data to illustrate the offline publishing function of map publishing service middleware, so satellite image data and place name tags only provide the top 10 global data

You can reply to “free data” through private message, get the high-definition satellite image data of a province, and then update to the corresponding data directory