Skip to content

Commit 8ff7fcd

Browse files
DOC: Add gallery example for using EPSG codes (#3973)
Co-authored-by: Dongdong Tian <[email protected]>
1 parent 2bc5931 commit 8ff7fcd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

examples/gallery/maps/epsg_codes.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
EPSG codes
3+
==========
4+
5+
Besides one of the :doc:`31 projections supported by GMT </techref/projections>`, users
6+
can pass an EPSG (European Petroleum Survey Group) code to the ``projection`` parameter.
7+
A commonly used EPSG code is ``EPSG:3857``, that refers to the Web Mercator projection
8+
WGS84. More information on the EPSG dataset can be found at https://epsg.org and
9+
https://spatialreference.org/. Please note, that not all EPSG codes are supported by
10+
GMT / PyGMT.
11+
"""
12+
13+
# %%
14+
import pygmt
15+
16+
fig = pygmt.Figure()
17+
18+
# Pass the desired EPSG code and the width of the map (separated by a slash) to the
19+
# projection parameter
20+
fig.basemap(region=[-180, 180, -60, 60], projection="EPSG:3857/10c", frame=30)
21+
fig.coast(land="gray", shorelines="1/0.1p,gray10")
22+
23+
fig.show()

0 commit comments

Comments
 (0)