Python implements latitude and longitude conversion

1. Basic knowledge of coordinate axes:

At present, there are mainly the following three coordinate systems in China:

  • WGS84 : It is a geodetic coordinate system, and it is also the coordinate system used by the widely used GPS global satellite positioning system. Also known as WGS-84 coordinates is an international standard, general satellite navigation, and the data in the original GPS equipment use this coordinate system. Foreign Google Maps, OSM, etc. all use this coordinate.
  • GCJ02 : National Bureau of Survey coordinates GCJ-02 coordinates are also called Mars coordinates, which are coordinates obtained by the National Bureau of Surveying and Mapping on the basis of the original coordinates for national security. Basically, domestic electronic maps and navigation equipment use this coordinate Departments, such as: Gaode, Soso, 51 maps, MapABC maps, and Google China maps.
  • BD09 : Baidu coordinate system, encrypted again on the basis of GCJ02 coordinate system. Among them, bd09ll indicates Baidu longitude and latitude coordinates, and bd09mc indicates Baidu Mercator metric coordinates.
    For maps of non-China regions, the service coordinates use WGS84 coordinates uniformly.

Python version Baidu coordinates (BD09), National Survey Bureau coordinates (Mars coordinates, GCJ02) and WGS84 coordinates are mutually converted

2. Interchange plan:

  • Solution 1: Use the official interface provided by Baidu (or Google). (requires internet connection, more accurate)
  • Solution 2: Use the "chinacoordtran" library in Python. (no internet connection required)
  • Solution 3: Realize the coordinate conversion scheme by yourself (no need to connect to the Internet)

How to judge that your computer can be connected to the Internet:
Provide a solution:

Guess you like

Origin blog.csdn.net/qq_42887760/article/details/125936952