(For reprint, please contact the author)

Why do map projections

In short, the surface of the Earth is a three-dimensional surface, and measuring on a surface is very difficult. Take a globe and measure the distance between two points or calculate an Angle. Projection of a three-dimensional surface onto a two-dimensional surface, so that we can use plane geometry.





youtube – Adventures with GIS: an introduction to IPython and the joy of play

What is a projection

If you want to understand map projection, you first need to know the geographic coordinate system and the projection coordinate system. Simply speaking, the geographic coordinate system is the spherical coordinate system with the reference plane as the ellipsoid. The most common spherical coordinate system is calculated by longitude and latitude. A projection coordinate system is a coordinate system defined on a two-dimensional plane, usually in meters. The process of transforming spherical coordinates into plane coordinates is called projection. Therefore, the projection coordinate system is always based on the geographic coordinate system.

Because the earth is an irregular pear-shaped sphere slightly wider at the equator and slightly flatter at the poles, and its surface is a non-flattening surface, any mathematical method used to perform this projection transformation will produce errors and distortions. Various projection methods have been developed to reduce the errors according to different needs. Like this very interesting article about interesting projection methods that you didn’t know about. You can also see the different projections of the Earth at the end of the article.

EPSG Code

If you work with maps often, you will be dazzled by all the fancy projection transformations. EPSG: European Petroleum Survey Group (EPSG) was established in 1986 and restructured as OGP(Internation Association of Oil & Gas Producers) in 2005, It is responsible for maintaining and publishing coordinate reference system data set parameters, as well as coordinate transformation description, the data set is widely accepted and used, distributed through a Web publishing platform, and also provides Microsoft Acess database storage files, through SQL script files, Databases such as MySQL, Oracle and PostgreSQL are also available. At present, different combinations of ellipsoid and projection coordinate system correspond to different ID numbers. This number is called EPSG Code in EPSG, which represents specific information of ellipsoid, unit, geographic coordinate system or projection coordinate system.

EPSG is directly used in the open source QGIS software.

The CRSs available in QGIS are based on those defined by the European Petroleum Search Group (EPSG) and the Institut Geographique National de France (IGNF) and are largely abstracted from the spatial reference tables used in GDAL. EPSG identifiers are present in the database and can be used to specify a CRS in QGIS.

A website for querying EPSG code epsg.io

Pyproj is a test case

Pyproj is a python interface encapsulation of PROJ4. Use EPSG code directly to define the projection parameters.

from pyproj import Proj,transform

# The Proj class can convert from geographic (longitude,latitude)
# to native map projection (x,y) coordinates and vice versa, 
# or from one map projection coordinate system directly to another.

p1 = Proj(init='epsg:26915')
p2 = Proj(init='epsg:26715')
x1, y1 = p1(92.199881.38.56694)
x2, y2 = transform(p1,p2.x1,y1)
print '% 9.3f % 11.3f' % (x1,y1)
print '% 9.3f % 11.3f' % (x2,y2)Copy the code

The output is

569704566. 4269024671.
569722342. 4268814027.Copy the code

Vector map projection based on geopandas

import shapely, geopandas, fiona
import seaborn as sns
from fiona.crs import from_epsg,from_string

# Data
shp = 'E:\NationalGISdata\Province.shp'Shp_df = geopandas. GeoDataFrame. From_file (SHP) # # IndexError error, using arcgis shapefile files to export again. Try shp_df head ()Copy the code




# Draw from current Lambert projection
shp_df.plot(column="GDP_1994",colormap='Set1')Copy the code




# Convert to latitude and longitude coordinates
shp_df_wgs84 = shp_df.to_crs(from_epsg(4326))
shp_df_wgs84.plot(column="GDP_1994",colormap='Set1')Copy the code




# National coordinate system 2000
# EPSG:4508 CGCS2000 / Gauss-Kruger CM 111E
shp_df_4508 = shp_df.to_crs(from_epsg(4508))
shp_df_4508.plot(column="GDP_1994",colormap='Set1')Copy the code




In addition to using ESPG code directly, you can also define your own projection parameters

ESRI_54024 = "" "
+proj=bonne +lon_0=0 +lat_1=60 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs 

shp_df_3408 = shp_df.to_crs(from_string(ESRI_54024))
shp_df_3408.plot(column="GDP_1994",colormap='Set1')Copy the code




Code and vector map data download

Download address: pan.baidu.com/s/1c1BExH2 Password please follow wechat official account stdrei and enter Projection directly to obtain it.

Development:One world, different faces

Link www.viewsoftheworld.net/?p=752 This world under different projections…