Intermediate, Advanced. Human Exploration, Moon, Software, Space Exploration.
Make an easy tool for comparing lunar south pole landing sites and dates, showing where the Sun and Earth sit above the horizon so planners can judge solar power and direct-to-Earth communication windows.
Computes positions of the Sun, Earth, planets and spacecraft as seen from any place and time, including a point on the lunar surface. Returns azimuth and elevation directly, which is exactly what solar power and Earth-communication windows need.
South polar tile layers from LRO: WAC percentage-based illumination (WAC_POLE_ILL_PCT_SOUTH_100M) and LOLA average Earth visibility (AVGVISIB_85S_060M_201608_EARTH_SP). Together they show where a lander gets sunlight for power and line of sight to Earth for communication.
NASA PDS Geosciences Node (Washington University in St. Louis)
No loginWorks in browser
A REST API for finding PDS products by mission, instrument and product type; for example LOLA gridded elevation (GDRDEM) of the Moon. Returns product lists with download links to the PDS archive.
Global LROC Wide Angle Camera image mosaic of the Moon served as standard WMTS tiles with open CORS, plus hundreds of other Moon Trek layers listed in the Trek API docs. A drop-in basemap for any lunar web app.
The toolkit and data files (kernels) NASA missions use for geometry: where bodies and spacecraft are, which way they point, and lighting angles. More setup than Horizons, but runs offline and at scale.
import requests
# Sun azimuth/elevation seen from a lunar south pole site (lon 0, lat -89.5).
# Use COMMAND='399' for Earth instead of the Sun ('10').
params = {
"format": "json",
"COMMAND": "'10'",
"MAKE_EPHEM": "'YES'", "EPHEM_TYPE": "'OBSERVER'", "OBJ_DATA": "'NO'",
"CENTER": "'coord@301'", "COORD_TYPE": "'GEODETIC'",
"SITE_COORD": "'0,-89.5,0'", # east lon, lat, altitude km
"START_TIME": "'2026-12-01'", "STOP_TIME": "'2026-12-03'",
"STEP_SIZE": "'6h'", "QUANTITIES": "'4'", # 4 = azimuth and elevation
}
r = requests.get("https://ssd.jpl.nasa.gov/api/horizons.api", params=params, timeout=60)
result = r.json()["result"]
table = result.split("$$SOE")[1].split("$$EOE")[0]
for line in table.strip().splitlines():
print(line)
Fetch a south pole illumination tileJavaScript
// Read the WMTS capabilities for the lunar south pole illumination layer,
// then fetch one tile. Moon Trek tiles send CORS headers.
const base = "https://trek.nasa.gov/tiles/Moon/SP/WAC_POLE_ILL_PCT_SOUTH_100M/1.0.0";
const xml = await fetch(`${base}/WMTSCapabilities.xml`).then((r) => r.text());
const template = xml.match(/template="([^"]+)"/)[1];
const matrixSet = xml.match(/<TileMatrixSet>([^<]+)<\/TileMatrixSet>/)[1];
console.log("tile template:", template);
const tileUrl = template
.replace("{Style}", "default").replace("{TileMatrixSet}", matrixSet)
.replace("{TileMatrix}", "0").replace("{TileRow}", "0").replace("{TileCol}", "0");
const tile = await fetch(tileUrl);
console.log(tile.status, tile.headers.get("content-type"), tileUrl);
// Earth visibility layer: swap the path to AVGVISIB_85S_060M_201608_EARTH_SP