Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added example of setting projection using EPSG, and modified rgb_example to incorporate this #3622

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions examples/gallery/images/rgb_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,19 @@
# Plot the RGB imagery:
fig = pygmt.Figure()
with pygmt.config(FONT_TITLE="Times-Roman"): # Set title font to Times-Roman
fig.grdimage(
grid=image,
# Use a map scale where 1 cm on the map equals 1 km on the ground
projection="x1:100000",
frame=[r"WSne+tL@!a¯hain@!a¯, Hawai`i on 9 Aug 2023", "af"],
(
fig.grdimage(
grid=image,
# Use a map scale where 1 cm on the map equals 1 km on the ground
projection="x1:100000",
frame=[r"WSne+tL@!a¯hain@!a¯, Hawai`i on 9 Aug 2023", "af"],
),
)
fig.coast(
region=[738000, 755000, 2300000, 2318000],
projection="EPSG:32604",
frame=False,
shorelines="1p",
)

fig.show()
32 changes: 32 additions & 0 deletions examples/projections/misc/misc_epsg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
r"""
Using EPSG codes to specify projection
===============================

The EPSG registry is a public registry of geodetic datums, spatial reference systems,
Earth ellipsoids, coordinate transformations and related units of measurement.

These are used frequently in GIS software and data. If data are plotted using a linear
projection, additional features (e.g. coast) can be made congruent by specifying EPSG.
See Gallery Example "RGB Image"

Some common EPSG codes are:

EPSG:4326 - WGS 84 - latitude/longitude coordinate system based on the Earth's centre
of mass, used by the Global Positioning System among others.

EPSG:3857 - Web Mercator - used for display by many web-based mapping tools, including
Google Maps and OpenStreetMap.


**[EPSG:XXXX]**

"""

# %%
import pygmt

fig = pygmt.Figure()
fig.coast(
region=[-180, 180, -80, 80], projection="EPSG:3857", frame=True, shorelines="1p"
)
fig.show()
Loading