Upload 13 files
Browse filesFiles changed (14)
- .gitattributes+8
- app.jsAdded+723
- index.html+120-19
- locations.jsAdded+246
- lroc_color_poles_16k.tifAdded
- moon_color_16k.jpgAdded
- moon_color_2k.jpgAdded
- moon_color_8k.jpgAdded
- moon_colorful.jpgAdded
- moon_geologic_16k.jpgAdded
- moon_geologic_2k.jpgAdded
- moon_geologic_8k.jpgAdded
- reproject.pyAdded+94
- style.css+467-28
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines333435363738394041424332 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textlroc_color_poles_16k.tif filter=lfs diff=lfs merge=lfs -textmoon_color_16k.jpg filter=lfs diff=lfs merge=lfs -textmoon_color_2k.jpg filter=lfs diff=lfs merge=lfs -textmoon_color_8k.jpg filter=lfs diff=lfs merge=lfs -textmoon_colorful.jpg filter=lfs diff=lfs merge=lfs -textmoon_geologic_16k.jpg filter=lfs diff=lfs merge=lfs -textmoon_geologic_2k.jpg filter=lfs diff=lfs merge=lfs -textmoon_geologic_8k.jpg filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723import * as THREE from "three";
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
import { LOCATIONS } from "./locations.js";
/* =========================================================
Moon textures. Each style has a small 2K map (instant view)
and a crisp 8K map that swaps in when ready. Both are true
2:1 equirectangular maps (centered on 0° longitude, north up,
East to the right), so lat/lon pins align accurately.
- "color": NASA SVS "CGI Moon Kit" LROC color map
(https://svs.gsfc.nasa.gov/4720), from lroc_color_poles_16k.tif.
- "geologic": USGS Unified Geologic Map of the Moon (SIM 3316),
reprojected to full-globe equirectangular from the poster: the
Mercator ±57° body for mid-latitudes plus the two polar
stereographic insets reprojected into the pole caps, so the
north and south poles show real geology.
========================================================= */
const MOON_MAPS = {
color: {
low: "moon_color_2k.jpg",
high: "moon_color_8k.jpg",
ultra: "moon_color_16k.jpg", // native 16384×8192 (real detail)
},
geologic: {
low: "moon_geologic_2k.jpg",
high: "moon_geologic_8k.jpg",
ultra: "moon_geologic_16k.jpg",
},
};
let currentMapStyle = "color";
const MOON_RADIUS = 2;
/* =========================================================
Coordinate parsing
Accepts:
"42S 206E", "88.8S 123.4E"
"88°48'S 123°24'E" (degrees/minutes/seconds)
"-42, 206" (decimal lat, lon)
========================================================= */
function parseCoordinates(raw) {
const text = raw.trim();
// Try "lat, lon" pure decimal pair first: e.g. -42, 206
const decimalPair = text.match(
/^\s*(-?\d+(?:\.\d+)?)\s*[,\s]\s*(-?\d+(?:\.\d+)?)\s*$/
);
if (decimalPair) {
return { lat: parseFloat(decimalPair[1]), lon: parseFloat(decimalPair[2]) };
}
// General DMS / decimal with hemisphere letters
const parts = parseHemisphereTokens(text);
if (parts && parts.lat != null && parts.lon != null) {
return { lat: parts.lat, lon: parts.lon };
}
return null;
}
function parseHemisphereTokens(text) {
// Split into a latitude token (N/S) and longitude token (E/W)
const latMatch = text.match(
/(\d+(?:\.\d+)?)\s*(?:°|deg|d)?\s*(?:(\d+(?:\.\d+)?)\s*['′]\s*)?(?:(\d+(?:\.\d+)?)\s*(?:''|″|"))?\s*([NnSs])/
);
const lonMatch = text.match(
/(\d+(?:\.\d+)?)\s*(?:°|deg|d)?\s*(?:(\d+(?:\.\d+)?)\s*['′]\s*)?(?:(\d+(?:\.\d+)?)\s*(?:''|″|"))?\s*([EeWw])/
);
if (!latMatch && !lonMatch) return null;
const toDeg = (m) => {
if (!m) return null;
const d = parseFloat(m[1] || 0);
const min = parseFloat(m[2] || 0);
const sec = parseFloat(m[3] || 0);
let val = d + min / 60 + sec / 3600;
const hemi = m[4].toUpperCase();
if (hemi === "S" || hemi === "W") val = -val;
return val;
};
return { lat: toDeg(latMatch), lon: toDeg(lonMatch) };
}
/* Normalize longitude into -180..180 (East positive) */
function normLon(lon) {
let l = ((lon + 180) % 360 + 360) % 360 - 180;
return l;
}
/* =========================================================
Convert lat/lon -> 3D position on the sphere
Aligned to an equirectangular texture centered at lon 0,
with left edge at lon -180 (matching the lunar maps).
========================================================= */
function latLonToVector3(lat, lon, radius) {
const phi = (90 - lat) * (Math.PI / 180);
const theta = (normLon(lon) + 180) * (Math.PI / 180);
const x = -radius * Math.sin(phi) * Math.cos(theta);
const z = radius * Math.sin(phi) * Math.sin(theta);
const y = radius * Math.cos(phi);
return new THREE.Vector3(x, y, z);
}
function formatCoord(lat, lon) {
const latH = lat >= 0 ? "N" : "S";
const lonH = normLon(lon) >= 0 ? "E" : "W";
return `${Math.abs(lat).toFixed(2)}° ${latH}, ${Math.abs(normLon(lon)).toFixed(2)}° ${lonH}`;
}
/* =========================================================
THREE.js scene
========================================================= */
let scene, camera, renderer, controls, moon, marker, markerRing, graticule;
let markerEnabled = true; // user preference (Marker on/off)
let markerPlaced = false; // whether a location has been located yet
const container = document.getElementById("scene-container");
function initScene() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(
45,
container.clientWidth / container.clientHeight,
0.01,
1000
);
camera.position.set(0, 0, 6);
renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(container.clientWidth, container.clientHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
container.appendChild(renderer.domElement);
// Lighting — bright and even so the colorful map stays vivid
scene.add(new THREE.AmbientLight(0xffffff, 1.1));
const key = new THREE.DirectionalLight(0xffffff, 1.0);
key.position.set(5, 3, 5);
scene.add(key);
const fill = new THREE.DirectionalLight(0x88aaff, 0.4);
fill.position.set(-5, -2, -4);
scene.add(fill);
// Starfield background
scene.add(createStarfield());
// Moon
const geometry = new THREE.SphereGeometry(MOON_RADIUS, 128, 128);
const material = new THREE.MeshStandardMaterial({
color: 0xffffff,
roughness: 0.95,
metalness: 0.0,
});
moon = new THREE.Mesh(geometry, material);
scene.add(moon);
loadMoonTexture();
// Lat/Lon coordinate grid (graticule)
graticule = buildGraticule();
scene.add(graticule);
// Soft glow atmosphere
const glowGeo = new THREE.SphereGeometry(MOON_RADIUS * 1.03, 64, 64);
const glowMat = new THREE.MeshBasicMaterial({
color: 0x5a7bff,
transparent: true,
opacity: 0.06,
side: THREE.BackSide,
});
scene.add(new THREE.Mesh(glowGeo, glowMat));
// Marker (a glowing pin + pulsing ring)
buildMarker();
// Controls
controls = new OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.dampingFactor = 0.08;
controls.rotateSpeed = 0.5;
controls.minDistance = MOON_RADIUS * 1.15;
controls.maxDistance = 20;
window.addEventListener("resize", onResize);
animate();
}
function createStarfield() {
const count = 2500;
const positions = new Float32Array(count * 3);
const colors = new Float32Array(count * 3);
for (let i = 0; i < count; i++) {
const r = 120 + Math.random() * 300;
const t = Math.random() * Math.PI * 2;
const p = Math.acos(2 * Math.random() - 1);
positions[i * 3] = r * Math.sin(p) * Math.cos(t);
positions[i * 3 + 1] = r * Math.sin(p) * Math.sin(t);
positions[i * 3 + 2] = r * Math.cos(p);
const shade = 0.6 + Math.random() * 0.4;
colors[i * 3] = shade;
colors[i * 3 + 1] = shade;
colors[i * 3 + 2] = shade * (0.9 + Math.random() * 0.1);
}
const geo = new THREE.BufferGeometry();
geo.setAttribute("position", new THREE.BufferAttribute(positions, 3));
geo.setAttribute("color", new THREE.BufferAttribute(colors, 3));
const mat = new THREE.PointsMaterial({
size: 0.7,
sizeAttenuation: true,
vertexColors: true,
transparent: true,
opacity: 0.9,
});
return new THREE.Points(geo, mat);
}
function buildMarker() {
marker = new THREE.Group();
// Pin stem
const pinGeo = new THREE.ConeGeometry(0.045, 0.18, 24);
const pinMat = new THREE.MeshStandardMaterial({
color: 0xff5566,
emissive: 0xff3344,
emissiveIntensity: 0.7,
roughness: 0.3,
});
const pin = new THREE.Mesh(pinGeo, pinMat);
pin.position.y = 0.09;
pin.rotation.x = Math.PI; // tip points toward the surface
marker.add(pin);
// Head sphere
const headGeo = new THREE.SphereGeometry(0.05, 24, 24);
const head = new THREE.Mesh(headGeo, pinMat);
head.position.y = 0.18;
marker.add(head);
// Pulsing ring on the surface
const ringGeo = new THREE.RingGeometry(0.05, 0.09, 48);
const ringMat = new THREE.MeshBasicMaterial({
color: 0xffd479,
transparent: true,
opacity: 0.9,
side: THREE.DoubleSide,
});
markerRing = new THREE.Mesh(ringGeo, ringMat);
markerRing.rotation.x = -Math.PI / 2;
marker.add(markerRing);
marker.visible = false;
scene.add(marker);
}
const textureLoader = new THREE.TextureLoader();
textureLoader.crossOrigin = "anonymous";
function applyTexture(tex) {
tex.colorSpace = THREE.SRGBColorSpace;
tex.anisotropy = renderer.capabilities.getMaxAnisotropy();
const old = moon.material.map;
moon.material.map = tex;
moon.material.needsUpdate = true;
if (old) old.dispose();
}
let mapLoadToken = 0;
function loadMoonTexture(style = currentMapStyle) {
currentMapStyle = style;
const maps = MOON_MAPS[style];
const token = ++mapLoadToken; // guards against stale swaps when switching
const loadingEl = document.getElementById("loading");
loadingEl.classList.remove("hidden");
// 1) Load the small map first for an instant, low-latency view.
textureLoader.load(
maps.low,
(lowTex) => {
if (token !== mapLoadToken) { lowTex.dispose(); return; }
applyTexture(lowTex);
loadingEl.classList.add("hidden");
// 2) Then load the high-res (8K) map and swap it in when ready.
textureLoader.load(maps.high, (highTex) => {
if (token !== mapLoadToken) { highTex.dispose(); return; }
applyTexture(highTex);
// 3) Finally, on capable GPUs, load the full 16K "ultra" map.
const maxTex = renderer.capabilities.maxTextureSize;
if (maps.ultra && maxTex >= 16384) {
textureLoader.load(maps.ultra, (ultraTex) => {
if (token !== mapLoadToken) { ultraTex.dispose(); return; }
applyTexture(ultraTex);
});
}
});
},
undefined,
() => {
// Fallback: procedural colorful texture if the image fails to load.
moon.material.map = makeFallbackTexture();
moon.material.needsUpdate = true;
loadingEl.classList.add("hidden");
console.warn("Moon map failed to load; using procedural fallback.");
}
);
}
function makeFallbackTexture() {
const c = document.createElement("canvas");
c.width = 2048;
c.height = 1024;
const ctx = c.getContext("2d");
// gradient base
const g = ctx.createLinearGradient(0, 0, c.width, c.height);
g.addColorStop(0, "#6b5b95");
g.addColorStop(0.5, "#c98b6b");
g.addColorStop(1, "#4a6b8a");
ctx.fillStyle = g;
ctx.fillRect(0, 0, c.width, c.height);
// random colorful "geologic" blobs
const palette = ["#e07a5f", "#3d9970", "#f2cc8f", "#81b29a", "#8e6c88", "#d0e1f9"];
for (let i = 0; i < 900; i++) {
ctx.beginPath();
ctx.fillStyle = palette[(Math.random() * palette.length) | 0];
ctx.globalAlpha = 0.5;
const x = Math.random() * c.width;
const y = Math.random() * c.height;
const r = 10 + Math.random() * 70;
ctx.arc(x, y, r, 0, Math.PI * 2);
ctx.fill();
}
ctx.globalAlpha = 1;
const tex = new THREE.CanvasTexture(c);
tex.colorSpace = THREE.SRGBColorSpace;
return tex;
}
/* Build a lat/lon graticule (grid lines every 30°) hovering just
above the surface, plus emphasized equator and prime meridian. */
function buildGraticuleLine(points, color, opacity) {
const geo = new THREE.BufferGeometry().setFromPoints(points);
const mat = new THREE.LineBasicMaterial({
color,
transparent: true,
opacity,
});
return new THREE.Line(geo, mat);
}
/* A camera-facing text label rendered from a canvas texture. */
function makeTextSprite(message, color) {
const canvas = document.createElement("canvas");
const size = 128;
canvas.width = 256;
canvas.height = size;
const ctx = canvas.getContext("2d");
ctx.font = "bold 64px 'Segoe UI', system-ui, sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
// soft outline for legibility over any surface
ctx.lineWidth = 8;
ctx.strokeStyle = "rgba(3, 5, 14, 0.85)";
ctx.strokeText(message, 128, size / 2);
ctx.fillStyle = color;
ctx.fillText(message, 128, size / 2);
const tex = new THREE.CanvasTexture(canvas);
tex.colorSpace = THREE.SRGBColorSpace;
const mat = new THREE.SpriteMaterial({
map: tex,
transparent: true,
depthTest: true, // hide labels on the far hemisphere
});
const sprite = new THREE.Sprite(mat);
sprite.scale.set(0.4, 0.2, 1);
return sprite;
}
function fmtLat(lat) {
if (lat === 0) return "0°";
return `${Math.abs(lat)}°${lat > 0 ? "N" : "S"}`;
}
function fmtLon(lon) {
const l = normLon(lon);
if (l === 0) return "0°";
if (Math.abs(l) === 180) return "180°";
return `${Math.abs(l)}°${l > 0 ? "E" : "W"}`;
}
function buildGraticule() {
const group = new THREE.Group();
const R = MOON_RADIUS * 1.002;
const step = 30; // degrees between grid lines
const seg = 120;
// Parallels (constant latitude)
for (let lat = -60; lat <= 60; lat += step) {
const pts = [];
for (let i = 0; i <= seg; i++) {
const lon = -180 + (360 * i) / seg;
pts.push(latLonToVector3(lat, lon, R));
}
const emphasize = lat === 0;
group.add(
buildGraticuleLine(pts, emphasize ? 0xffd479 : 0x9fb4ff, emphasize ? 0.55 : 0.22)
);
}
// Meridians (constant longitude)
for (let lon = -180; lon < 180; lon += step) {
const pts = [];
for (let i = 0; i <= seg; i++) {
const lat = -90 + (180 * i) / seg;
pts.push(latLonToVector3(lat, lon, R));
}
const emphasize = lon === 0;
group.add(
buildGraticuleLine(pts, emphasize ? 0xffd479 : 0x9fb4ff, emphasize ? 0.55 : 0.22)
);
}
// Degree labels
const labelR = R * 1.012;
// Latitude numbers along the prime meridian (lon 0); equator is
// labelled by the longitude loop below, so skip lat 0 here.
for (let lat = -60; lat <= 60; lat += step) {
if (lat === 0) continue;
const s = makeTextSprite(fmtLat(lat), "#cdd8ff");
s.position.copy(latLonToVector3(lat, 0, labelR));
group.add(s);
}
// Longitude numbers along the equator
for (let lon = -180; lon < 180; lon += step) {
const s = makeTextSprite(fmtLon(lon), lon === 0 ? "#ffd479" : "#cdd8ff");
s.position.copy(latLonToVector3(0, lon, labelR));
group.add(s);
}
return group;
}
function onResize() {
camera.aspect = container.clientWidth / container.clientHeight;
camera.updateProjectionMatrix();
renderer.setSize(container.clientWidth, container.clientHeight);
}
/* =========================================================
Camera fly-to animation
========================================================= */
let flying = false;
let flyStart, flyEnd, flyTargetStart, flyTargetEnd, flyT0;
const FLY_DURATION = 1600;
function flyTo(lat, lon) {
const surface = latLonToVector3(lat, lon, MOON_RADIUS);
// Place & orient marker on the surface.
// Cone, head and ring were built along local +Y, so rotate the
// group so its +Y axis points outward along the surface normal.
marker.position.copy(surface);
const normal = surface.clone().normalize();
const quat = new THREE.Quaternion().setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
normal
);
marker.quaternion.copy(quat);
markerPlaced = true;
marker.visible = markerEnabled; // hidden if the user turned the marker off
// Camera destination: pull back along the surface normal
const camDist = MOON_RADIUS * 1.7;
flyEnd = normal.clone().multiplyScalar(camDist);
flyStart = camera.position.clone();
flyTargetStart = controls.target.clone();
flyTargetEnd = new THREE.Vector3(0, 0, 0);
flyT0 = performance.now();
flying = true;
}
function easeInOut(t) {
return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
}
function animate() {
requestAnimationFrame(animate);
const now = performance.now();
if (flying) {
const t = Math.min((now - flyT0) / FLY_DURATION, 1);
const e = easeInOut(t);
// Spherical interpolation of camera position keeps it outside the moon
const from = flyStart.clone().normalize();
const to = flyEnd.clone().normalize();
const dir = new THREE.Vector3().copy(from).lerp(to, e).normalize();
const dist = THREE.MathUtils.lerp(flyStart.length(), flyEnd.length(), e);
camera.position.copy(dir.multiplyScalar(dist));
controls.target.lerpVectors(flyTargetStart, flyTargetEnd, e);
if (t >= 1) flying = false;
}
// Pulse the marker ring
if (marker && marker.visible) {
const s = 1 + Math.sin(now * 0.005) * 0.25;
markerRing.scale.set(s, s, s);
markerRing.material.opacity = 0.4 + (Math.sin(now * 0.005) + 1) * 0.25;
}
controls.update();
updateReadout();
renderer.render(scene, camera);
}
/* Show the lat/lon the camera is currently looking at */
const readoutEl = document.getElementById("coord-readout");
function updateReadout() {
const dir = camera.position.clone().normalize();
const lat = 90 - Math.acos(dir.y) * (180 / Math.PI);
let theta = Math.atan2(dir.z, -dir.x) * (180 / Math.PI);
let lon = normLon(theta - 180);
readoutEl.textContent = `center ${formatCoord(lat, lon)}`;
}
/* =========================================================
Search + UI
========================================================= */
const input = document.getElementById("search-input");
const searchBtn = document.getElementById("search-btn");
const suggestionsEl = document.getElementById("suggestions");
const resultEl = document.getElementById("result");
function showResult(name, lat, lon, desc) {
document.getElementById("result-name").textContent = name;
document.getElementById("result-coords").textContent = formatCoord(lat, lon);
document.getElementById("result-desc").textContent = desc || "";
resultEl.classList.remove("hidden");
}
function goToLocation(loc) {
flyTo(loc.lat, loc.lon);
showResult(loc.name, loc.lat, loc.lon, loc.desc);
suggestionsEl.classList.remove("show");
}
function handleSearch() {
const q = input.value.trim();
if (!q) return;
// 1) exact / fuzzy name match
const named = findLocationByName(q);
if (named) {
input.value = named.name;
goToLocation(named);
return;
}
// 2) coordinate parse
const coords = parseCoordinates(q);
if (coords && !isNaN(coords.lat) && !isNaN(coords.lon)) {
goToLocation({
name: "Custom coordinates",
lat: coords.lat,
lon: coords.lon,
desc: `Pinned location at the coordinates you entered.`,
});
return;
}
// 3) nothing matched
flashError();
}
function findLocationByName(q) {
const norm = (s) => s.toLowerCase().replace(/['’`]/g, "").replace(/\s+/g, " ").trim();
const nq = norm(q);
let exact = LOCATIONS.find((l) => norm(l.name) === nq);
if (exact) return exact;
let starts = LOCATIONS.find((l) => norm(l.name).startsWith(nq));
if (starts) return starts;
return LOCATIONS.find((l) => norm(l.name).includes(nq));
}
function flashError() {
input.style.borderColor = "#ff6b6b";
input.style.boxShadow = "0 0 0 3px rgba(255,107,107,0.15)";
setTimeout(() => {
input.style.borderColor = "";
input.style.boxShadow = "";
}, 800);
}
/* Autocomplete suggestions */
function updateSuggestions() {
const q = input.value.trim().toLowerCase().replace(/['’`]/g, "");
if (!q) {
suggestionsEl.classList.remove("show");
return;
}
const matches = LOCATIONS.filter((l) =>
l.name.toLowerCase().replace(/['’`]/g, "").includes(q)
).slice(0, 6);
if (matches.length === 0) {
suggestionsEl.classList.remove("show");
return;
}
suggestionsEl.innerHTML = matches
.map(
(l) =>
`<div class="suggestion" data-name="${l.name}">
<div>${l.name}</div>
<div class="s-coords">${formatCoord(l.lat, l.lon)}</div>
</div>`
)
.join("");
suggestionsEl.classList.add("show");
suggestionsEl.querySelectorAll(".suggestion").forEach((el) => {
el.addEventListener("click", () => {
const loc = LOCATIONS.find((l) => l.name === el.dataset.name);
input.value = loc.name;
goToLocation(loc);
});
});
}
/* Featured location dropdown, grouped by category */
function buildLocationSelect() {
const select = document.getElementById("location-select");
// Preserve category order as first-seen in the data.
const groups = new Map();
LOCATIONS.forEach((loc, idx) => {
const cat = loc.cat || "Other";
if (!groups.has(cat)) groups.set(cat, []);
groups.get(cat).push({ ...loc, idx });
});
groups.forEach((items, cat) => {
const og = document.createElement("optgroup");
og.label = cat;
items
.slice()
.sort((a, b) => a.name.localeCompare(b.name))
.forEach((loc) => {
const opt = document.createElement("option");
opt.value = String(loc.idx);
opt.textContent = loc.name;
og.appendChild(opt);
});
select.appendChild(og);
});
select.addEventListener("change", () => {
const loc = LOCATIONS[Number(select.value)];
if (!loc) return;
input.value = loc.name;
goToLocation(loc);
});
}
/* Toggle button groups (grid + marker), each scoped to its own row */
function wireToggles() {
document.querySelectorAll(".toggle-buttons").forEach((groupEl) => {
const buttons = groupEl.querySelectorAll(".toggle-btn");
buttons.forEach((btn) => {
btn.addEventListener("click", () => {
buttons.forEach((b) => b.classList.remove("active"));
btn.classList.add("active");
if ("style" in btn.dataset && btn.dataset.style !== currentMapStyle) {
loadMoonTexture(btn.dataset.style);
}
if ("grid" in btn.dataset && graticule) {
graticule.visible = btn.dataset.grid === "on";
}
if ("marker" in btn.dataset) {
markerEnabled = btn.dataset.marker === "on";
// Only show the marker if one has already been placed.
if (marker) marker.visible = markerEnabled && markerPlaced;
}
});
});
});
}
/* Minimize / expand the whole panel */
function wireMinimize() {
const panel = document.getElementById("panel");
const minBtn = document.getElementById("minimize-btn");
const expandBtn = document.getElementById("expand-btn");
minBtn.addEventListener("click", () => {
panel.classList.add("collapsed");
expandBtn.classList.add("show");
});
expandBtn.addEventListener("click", () => {
panel.classList.remove("collapsed");
expandBtn.classList.remove("show");
});
}
/* Event wiring */
searchBtn.addEventListener("click", handleSearch);
input.addEventListener("keydown", (e) => {
if (e.key === "Enter") {
handleSearch();
suggestionsEl.classList.remove("show");
}
});
input.addEventListener("input", updateSuggestions);
document.addEventListener("click", (e) => {
if (!e.target.closest(".search-box")) suggestionsEl.classList.remove("show");
});
/* =========================================================
Boot
========================================================= */
initScene();
buildLocationSelect();
wireToggles();
wireMinimize();12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Luna Maps — 3D Moon Explorer</title><link rel="stylesheet" href="style.css" /></head><body><div id="app"><!-- Search / control panel --><div id="panel"><div class="brand"><span class="logo">🌙</span><div class="brand-text"><h1>Luna Maps</h1><p>3D Moon Explorer · NASA LROC color</p></div><button id="minimize-btn" title="Minimize menu" aria-label="Minimize menu">–</button></div><div class="search-box"><inputid="search-input"type="text"autocomplete="off"placeholder="Search a crater, or type coordinates…"/><button id="search-btn" title="Search">Go</button><div id="suggestions"></div></div><div class="hint">Try: <code>Shackleton</code>, <code>Chang'e 6</code>,<code>88°48'S 123°24'E</code>, or <code>42S 206E</code></div><div id="result" class="result hidden"><div class="result-name" id="result-name"></div><div class="result-coords" id="result-coords"></div><div class="result-desc" id="result-desc"></div></div><div class="quick-list"><div class="quick-title">Featured locations</div><select id="location-select"><option value="" disabled selected>Select a lunar feature…</option></select></div><div class="map-toggle"><label>Map style</label><div class="toggle-buttons"><button class="toggle-btn active" data-style="color">LROC color</button><button class="toggle-btn" data-style="geologic">Geologic</button></div></div><div class="map-toggle"><label>Coordinate grid</label><div class="toggle-buttons"><button class="toggle-btn active" data-grid="on">Grid on</button><button class="toggle-btn" data-grid="off">Grid off</button></div></div><div class="map-toggle"><label>Location marker</label><div class="toggle-buttons"><button class="toggle-btn active" data-marker="on">Marker on</button><button class="toggle-btn" data-marker="off">Marker off</button></div></div><div class="reference"><label>References</label><a href="https://www.lpi.usra.edu/resources/mapcatalog/UGM/Unified_Geologic_Map_of_The_Moon_200dpi.jpg"target="_blank" rel="noopener noreferrer">Unified Geologic Map of the Moon (USGS SIM 3316) ↗</a><a href="https://svs.gsfc.nasa.gov/4720"target="_blank" rel="noopener noreferrer">NASA SVS — CGI Moon Kit (LROC color) ↗</a></div><div class="footer-note">Drag to rotate · Scroll to zoom · Coordinates use East longitude</div><div class="credit">Created by Andy Kong</div></div><!-- Collapsed pill to reopen the menu --><button id="expand-btn" title="Open menu" aria-label="Open menu"><span class="logo">🌙</span><span>Luna Maps</span></button><!-- 3D canvas --><div id="scene-container"><div id="loading"><div class="spinner"></div><span>Loading lunar surface…</span></div><div id="coord-readout"></div></div></div><script type="importmap">{"imports": {"three": "https://unpkg.com/three@0.160.0/build/three.module.js","three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/"}}</script><script type="module" src="app.js"></script></body></html>
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246/* =========================================================
Comprehensive lunar feature database.
Coordinates are selenographic: latitude (N+/S-) and
East longitude (E+/W-), in decimal degrees.
Sources:
- Maria / Oceanus / Lacus / Palus / Sinus centers:
USGS Gazetteer of Planetary Nomenclature (via Wikipedia
"List of plains on the Moon").
- Crater centers: USGS Gazetteer / Wikipedia.
- Landing & rover sites: mission / NASA-LRO reported coords.
========================================================= */
export const LOCATIONS = [
/* ---------- Landing & rover sites ---------- */
{ name: "Apollo 11 (Tranquility Base)", cat: "Landing & Rover Sites", lat: 0.674, lon: 23.473,
desc: "First crewed Moon landing, July 1969, in southwestern Mare Tranquillitatis." },
{ name: "Apollo 12", cat: "Landing & Rover Sites", lat: -3.01, lon: -23.42,
desc: "Landed near Surveyor 3 in Oceanus Procellarum (1969)." },
{ name: "Apollo 14", cat: "Landing & Rover Sites", lat: -3.65, lon: -17.47,
desc: "Landed in the Fra Mauro highlands (1971)." },
{ name: "Apollo 15", cat: "Landing & Rover Sites", lat: 26.13, lon: 3.63,
desc: "First lunar rover mission, at Hadley–Apennine (1971)." },
{ name: "Apollo 16", cat: "Landing & Rover Sites", lat: -8.97, lon: 15.50,
desc: "Explored the Descartes highlands (1972)." },
{ name: "Apollo 17", cat: "Landing & Rover Sites", lat: 20.19, lon: 30.77,
desc: "Last crewed Moon landing (1972), in the Taurus–Littrow valley." },
{ name: "Luna 2", cat: "Landing & Rover Sites", lat: 29.1, lon: 0.0,
desc: "First human-made object to reach the Moon (impact, 1959)." },
{ name: "Luna 9", cat: "Landing & Rover Sites", lat: 7.08, lon: -64.37,
desc: "First successful soft landing on the Moon (1966), in Oceanus Procellarum." },
{ name: "Luna 16", cat: "Landing & Rover Sites", lat: -0.68, lon: 56.30,
desc: "First robotic sample return (1970), from Mare Fecunditatis." },
{ name: "Luna 17 (Lunokhod 1)", cat: "Landing & Rover Sites", lat: 38.24, lon: -35.00,
desc: "Delivered the first roving vehicle to the Moon (1970)." },
{ name: "Luna 21 (Lunokhod 2)", cat: "Landing & Rover Sites", lat: 25.85, lon: 30.45,
desc: "Second Soviet rover (1973), in Le Monnier crater." },
{ name: "Luna 24", cat: "Landing & Rover Sites", lat: 12.71, lon: 62.21,
desc: "Final Luna sample-return mission (1976), Mare Crisium." },
{ name: "Surveyor 1", cat: "Landing & Rover Sites", lat: -2.47, lon: -43.34,
desc: "First US soft landing (1966), Oceanus Procellarum." },
{ name: "Surveyor 7", cat: "Landing & Rover Sites", lat: -40.86, lon: -11.47,
desc: "Final Surveyor mission (1968), on Tycho's northern ejecta." },
{ name: "Ranger 7 impact", cat: "Landing & Rover Sites", lat: -10.63, lon: -20.60,
desc: "First US probe to return close-up images before impact (1964); Mare Cognitum is named for it." },
{ name: "Chang'e 3 (Yutu)", cat: "Landing & Rover Sites", lat: 44.12, lon: -19.51,
desc: "China's first Moon landing and rover (2013), in Mare Imbrium." },
{ name: "Chang'e 4 (Yutu-2)", cat: "Landing & Rover Sites", lat: -45.44, lon: 177.60,
desc: "First-ever soft landing on the far side (2019), in Von Kármán crater." },
{ name: "Chang'e 5", cat: "Landing & Rover Sites", lat: 43.06, lon: -51.92,
desc: "Returned the first lunar samples in over 40 years (2020), Oceanus Procellarum." },
{ name: "Chang'e 6", cat: "Landing & Rover Sites", lat: -41.64, lon: -153.99,
desc: "First sample return from the far side (2024), in the South Pole–Aitken basin." },
{ name: "Chandrayaan-3 (Statio Shiv Shakti)", cat: "Landing & Rover Sites", lat: -69.37, lon: 32.32,
desc: "India's first soft landing (2023), the southernmost landing to date." },
{ name: "Luna 25 (impact)", cat: "Landing & Rover Sites", lat: -57.86, lon: 61.36,
desc: "Russian south-pole lander that crashed in 2023." },
{ name: "SLIM (Japan)", cat: "Landing & Rover Sites", lat: -13.32, lon: 25.25,
desc: "JAXA precision lander near Shioli crater (2024)." },
{ name: "IM-1 Odysseus", cat: "Landing & Rover Sites", lat: -80.13, lon: 1.44,
desc: "First US soft landing since Apollo (2024), near Malapert A at the south pole." },
/* ---------- Maria & Oceanus ---------- */
{ name: "Oceanus Procellarum", cat: "Maria, Oceans & Bays", lat: 20.67, lon: -56.68,
desc: "The 'Ocean of Storms' — the largest lunar plain, covering much of the western near side." },
{ name: "Mare Imbrium", cat: "Maria, Oceans & Bays", lat: 34.72, lon: -14.91,
desc: "'Sea of Rains' — a vast, ancient impact basin flooded with basalt." },
{ name: "Mare Serenitatis", cat: "Maria, Oceans & Bays", lat: 27.29, lon: 18.36,
desc: "'Sea of Serenity' — a prominent circular near-side mare." },
{ name: "Mare Tranquillitatis", cat: "Maria, Oceans & Bays", lat: 8.35, lon: 30.83,
desc: "'Sea of Tranquility' — site of the Apollo 11 landing." },
{ name: "Mare Crisium", cat: "Maria, Oceans & Bays", lat: 16.18, lon: 59.10,
desc: "'Sea of Crises' — an isolated circular mare near the eastern limb." },
{ name: "Mare Fecunditatis", cat: "Maria, Oceans & Bays", lat: -7.83, lon: 53.67,
desc: "'Sea of Fertility' — a large southeastern near-side mare." },
{ name: "Mare Nectaris", cat: "Maria, Oceans & Bays", lat: -15.19, lon: 34.60,
desc: "'Sea of Nectar' — a small circular mare in the southeast." },
{ name: "Mare Nubium", cat: "Maria, Oceans & Bays", lat: -20.59, lon: -17.29,
desc: "'Sea of Clouds' — a southern near-side mare." },
{ name: "Mare Humorum", cat: "Maria, Oceans & Bays", lat: -24.48, lon: -38.57,
desc: "'Sea of Moisture' — a circular basin in the southwest." },
{ name: "Mare Frigoris", cat: "Maria, Oceans & Bays", lat: 57.59, lon: -0.01,
desc: "'Sea of Cold' — a long arc across the far north." },
{ name: "Mare Vaporum", cat: "Maria, Oceans & Bays", lat: 13.20, lon: 4.09,
desc: "'Sea of Vapors' — near the center of the near side." },
{ name: "Mare Insularum", cat: "Maria, Oceans & Bays", lat: 7.79, lon: -30.64,
desc: "'Sea of Islands' — surrounds Copernicus crater." },
{ name: "Mare Cognitum", cat: "Maria, Oceans & Bays", lat: -10.53, lon: -22.31,
desc: "'Sea That Has Become Known' — explored by Ranger 7." },
{ name: "Mare Orientale", cat: "Maria, Oceans & Bays", lat: -19.87, lon: -94.67,
desc: "A spectacular multi-ring impact basin on the western limb." },
{ name: "Mare Marginis", cat: "Maria, Oceans & Bays", lat: 12.70, lon: 86.52,
desc: "'Sea of the Edge' — right on the eastern limb." },
{ name: "Mare Smythii", cat: "Maria, Oceans & Bays", lat: -1.71, lon: 87.05,
desc: "An equatorial mare on the eastern limb." },
{ name: "Mare Humboldtianum", cat: "Maria, Oceans & Bays", lat: 56.92, lon: 81.54,
desc: "A northeastern limb mare named for Alexander von Humboldt." },
{ name: "Mare Australe", cat: "Maria, Oceans & Bays", lat: -47.77, lon: 91.99,
desc: "'Southern Sea' — a diffuse mare on the southeastern limb." },
{ name: "Mare Moscoviense", cat: "Maria, Oceans & Bays", lat: 27.28, lon: 148.12,
desc: "A rare far-side mare, discovered by Luna 3." },
{ name: "Mare Ingenii", cat: "Maria, Oceans & Bays", lat: -33.25, lon: 164.83,
desc: "'Sea of Cleverness' — an unusual far-side mare." },
{ name: "Mare Anguis", cat: "Maria, Oceans & Bays", lat: 22.43, lon: 67.58,
desc: "'Serpent Sea' — a small mare northeast of Mare Crisium." },
{ name: "Mare Spumans", cat: "Maria, Oceans & Bays", lat: 1.30, lon: 65.30,
desc: "'Foaming Sea' — a small equatorial mare." },
{ name: "Mare Undarum", cat: "Maria, Oceans & Bays", lat: 7.49, lon: 68.66,
desc: "'Sea of Waves' — near the eastern limb." },
/* ---------- Bays, lakes & marshes ---------- */
{ name: "Sinus Iridum", cat: "Maria, Oceans & Bays", lat: 45.01, lon: -31.67,
desc: "'Bay of Rainbows' — a beautiful lava-flooded crater bay on Mare Imbrium." },
{ name: "Sinus Medii", cat: "Maria, Oceans & Bays", lat: 1.63, lon: 1.03,
desc: "'Bay of the Center' — at the Moon's near-side center." },
{ name: "Sinus Aestuum", cat: "Maria, Oceans & Bays", lat: 12.10, lon: -8.34,
desc: "'Bay of Billows' — southeast of Copernicus." },
{ name: "Sinus Roris", cat: "Maria, Oceans & Bays", lat: 50.26, lon: -50.86,
desc: "'Bay of Dew' — on the northwestern shore of the near side." },
{ name: "Lacus Mortis", cat: "Maria, Oceans & Bays", lat: 45.13, lon: 27.32,
desc: "'Lake of Death' — a hexagonal plain in the north." },
{ name: "Lacus Somniorum", cat: "Maria, Oceans & Bays", lat: 37.56, lon: 30.80,
desc: "'Lake of Dreams' — the largest lacus, northeast near side." },
{ name: "Palus Putredinis", cat: "Maria, Oceans & Bays", lat: 27.36, lon: 0.0,
desc: "'Marsh of Decay' — near the Apollo 15 site." },
{ name: "Palus Epidemiarum", cat: "Maria, Oceans & Bays", lat: -32.00, lon: -27.54,
desc: "'Marsh of Epidemics' — in the southwest." },
{ name: "Palus Somni", cat: "Maria, Oceans & Bays", lat: 13.69, lon: 44.72,
desc: "'Marsh of Sleep' — east of Mare Tranquillitatis." },
/* ---------- Craters ---------- */
{ name: "Tycho", cat: "Craters", lat: -43.31, lon: -11.36,
desc: "Young rayed crater whose bright ejecta rays span much of the near side." },
{ name: "Copernicus", cat: "Craters", lat: 9.62, lon: -20.08,
desc: "A textbook complex crater with terraced walls and central peaks." },
{ name: "Kepler", cat: "Craters", lat: 8.12, lon: -38.01,
desc: "A bright rayed crater between Copernicus and Aristarchus." },
{ name: "Aristarchus", cat: "Craters", lat: 23.73, lon: -47.49,
desc: "The brightest large feature on the Moon, on the Aristarchus plateau." },
{ name: "Herodotus", cat: "Craters", lat: 23.24, lon: -49.76,
desc: "A lava-flooded crater beside Aristarchus and Vallis Schröteri." },
{ name: "Plato", cat: "Craters", lat: 51.62, lon: -9.38,
desc: "A dark, lava-filled crater on the northern shore of Mare Imbrium." },
{ name: "Archimedes", cat: "Craters", lat: 29.72, lon: -3.99,
desc: "The largest crater on Mare Imbrium, with a smooth flooded floor." },
{ name: "Aristillus", cat: "Craters", lat: 33.88, lon: 1.21,
desc: "A sharp-rimmed crater with prominent central peaks in Mare Imbrium." },
{ name: "Autolycus", cat: "Craters", lat: 30.69, lon: 1.49,
desc: "A rugged crater south of Aristillus." },
{ name: "Eratosthenes", cat: "Craters", lat: 14.47, lon: -11.32,
desc: "A well-preserved crater at the end of the Montes Apenninus." },
{ name: "Ptolemaeus", cat: "Craters", lat: -9.16, lon: -1.84,
desc: "A large ancient walled plain near the near-side center." },
{ name: "Alphonsus", cat: "Craters", lat: -13.40, lon: -2.84,
desc: "A crater with a central peak and dark halo spots; target of Ranger 9." },
{ name: "Arzachel", cat: "Craters", lat: -18.26, lon: -1.94,
desc: "A deep terraced crater completing the Ptolemaeus chain." },
{ name: "Clavius", cat: "Craters", lat: -58.62, lon: -14.70,
desc: "One of the largest craters, in the southern highlands, with an arc of smaller craters." },
{ name: "Maginus", cat: "Craters", lat: -50.09, lon: -6.28,
desc: "A large eroded crater near Clavius." },
{ name: "Moretus", cat: "Craters", lat: -70.62, lon: -5.47,
desc: "A deep crater with a tall central peak, far south." },
{ name: "Grimaldi", cat: "Craters", lat: -5.38, lon: -68.36,
desc: "A dark-floored walled plain near the western limb." },
{ name: "Gassendi", cat: "Craters", lat: -17.55, lon: -39.96,
desc: "A crater with fractured floor on the north edge of Mare Humorum." },
{ name: "Bullialdus", cat: "Craters", lat: -20.74, lon: -22.26,
desc: "A crisp crater standing in Mare Nubium." },
{ name: "Theophilus", cat: "Craters", lat: -11.42, lon: 26.37,
desc: "A deep crater with massive central peaks, overlapping Cyrillus." },
{ name: "Cyrillus", cat: "Craters", lat: -13.25, lon: 24.03,
desc: "An eroded crater beside Theophilus." },
{ name: "Catharina", cat: "Craters", lat: -18.10, lon: 23.55,
desc: "The southern member of the Theophilus–Cyrillus–Catharina chain." },
{ name: "Langrenus", cat: "Craters", lat: -8.86, lon: 61.06,
desc: "A large bright crater on the eastern shore of Mare Fecunditatis." },
{ name: "Petavius", cat: "Craters", lat: -25.34, lon: 60.42,
desc: "A grand crater with a fractured floor and central peak, near the SE limb." },
{ name: "Posidonius", cat: "Craters", lat: 31.83, lon: 29.92,
desc: "A flooded crater with a complex floor on Mare Serenitatis' edge." },
{ name: "Aristoteles", cat: "Craters", lat: 50.24, lon: 17.32,
desc: "A prominent northern crater paired with Eudoxus." },
{ name: "Eudoxus", cat: "Craters", lat: 44.27, lon: 16.30,
desc: "A sharp crater south of Aristoteles." },
{ name: "Cassini", cat: "Craters", lat: 40.23, lon: 4.56,
desc: "A flooded crater containing smaller craters, in Mare Imbrium's north." },
{ name: "Fracastorius", cat: "Craters", lat: -21.50, lon: 33.20,
desc: "A crater breached by the lavas of Mare Nectaris." },
{ name: "Maurolycus", cat: "Craters", lat: -41.97, lon: 14.02,
desc: "A large rugged crater in the southern highlands." },
{ name: "Walther", cat: "Craters", lat: -33.11, lon: 1.00,
desc: "A worn crater in the southern highlands." },
{ name: "Werner", cat: "Craters", lat: -28.02, lon: 3.32,
desc: "A crisp crater beside Aliacensis." },
{ name: "Deslandres", cat: "Craters", lat: -33.05, lon: -5.42,
desc: "A huge, heavily degraded walled plain." },
{ name: "Piccolomini", cat: "Craters", lat: -29.72, lon: 32.21,
desc: "A fine crater at the south end of Rupes Altai." },
{ name: "Cleomedes", cat: "Craters", lat: 27.72, lon: 55.53,
desc: "A large crater north of Mare Crisium." },
{ name: "Endymion", cat: "Craters", lat: 53.92, lon: 57.02,
desc: "A dark-floored crater in the northeast." },
{ name: "Atlas", cat: "Craters", lat: 46.74, lon: 44.38,
desc: "A crater with a fractured floor, paired with Hercules." },
{ name: "Hercules", cat: "Craters", lat: 46.68, lon: 39.14,
desc: "A deep crater beside Atlas." },
{ name: "Geminus", cat: "Craters", lat: 34.48, lon: 56.68,
desc: "A well-formed crater in the northeast near side." },
{ name: "Proclus", cat: "Craters", lat: 16.10, lon: 46.89,
desc: "A brilliant crater with an asymmetric ray system, west of Mare Crisium." },
{ name: "Hipparchus", cat: "Craters", lat: -5.10, lon: 5.19,
desc: "An ancient degraded walled plain near the near-side center." },
{ name: "Albategnius", cat: "Craters", lat: -11.24, lon: 4.07,
desc: "A walled plain with a central peak, south of Hipparchus." },
{ name: "Fra Mauro", cat: "Craters", lat: -6.06, lon: -16.98,
desc: "A worn crater; the Apollo 14 landing site lies just north." },
{ name: "Schickard", cat: "Craters", lat: -44.35, lon: -55.26,
desc: "A very large crater in the southwest with a patchy floor." },
{ name: "Bailly", cat: "Craters", lat: -66.75, lon: -68.65,
desc: "The largest crater on the near side, near the SW limb." },
{ name: "Tsiolkovskiy", cat: "Craters", lat: -20.40, lon: 129.06,
desc: "A striking far-side crater with a dark, lava-flooded floor and central peak." },
{ name: "Korolev", cat: "Craters", lat: -4.0, lon: -157.4,
desc: "A large far-side basin filled with smaller craters." },
{ name: "Hertzsprung", cat: "Craters", lat: 1.4, lon: -128.7,
desc: "A far-side impact basin near the western limb." },
{ name: "Mendeleev", cat: "Craters", lat: 5.7, lon: 140.9,
desc: "A far-side walled plain once studied as a base candidate." },
{ name: "Gagarin", cat: "Craters", lat: -20.2, lon: 149.2,
desc: "A large far-side crater named for the first human in space." },
{ name: "Von Kármán", cat: "Craters", lat: -44.8, lon: 175.9,
desc: "A far-side crater in the South Pole–Aitken basin; Chang'e 4 landed here." },
{ name: "Antoniadi", cat: "Craters", lat: -69.7, lon: -172.0,
desc: "Contains the lowest point on the Moon, in the far-side south." },
/* ---------- Poles & special ---------- */
{ name: "Shackleton (South Pole)", cat: "Poles & Basins", lat: -89.66, lon: 129.2,
desc: "Crater at the lunar south pole; its rim gets near-constant sunlight while its floor is permanently shadowed — a prime target for water ice." },
{ name: "Peary (North Pole)", cat: "Poles & Basins", lat: 88.63, lon: 33.0,
desc: "Crater near the north pole with regions of near-permanent sunlight." },
{ name: "South Pole–Aitken Basin", cat: "Poles & Basins", lat: -53.0, lon: 191.0,
desc: "The largest, deepest and oldest impact basin on the Moon, on the far side." },
{ name: "Apollo Basin", cat: "Poles & Basins", lat: -36.1, lon: -151.8,
desc: "A double-ringed basin within South Pole–Aitken; near the Chang'e 6 site." },
];12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394"""
Build a full-globe equirectangular geologic texture from the USGS
Unified Geologic Map poster (SIM 3316):
- Equatorial band (|lat| <= 57 deg): Mercator map body at the bottom
of the poster, reprojected to equirectangular.
- Polar caps (|lat| > 57 deg): the two Polar Stereographic insets at
the top of the poster, reprojected into the pole caps.
Poster geometry (measured):
Mercator body bbox : x 311..8906, y 3752..7082 (Mercator +/-57 deg)
North inset (left) : center (1725, 1827), radius 1420 px, edge = 55 deg
South inset (right): center (7477, 1826), radius 1420 px, edge = 55 deg
Stereographic calibration: data-circle edge (radius R) is latitude 55 deg,
i.e. colatitude 35 deg, so pixel radius r = s * tan(colat/2) with
s = R / tan(35 deg / 2).
"""
from PIL import Image
import numpy as np
import math
Image.MAX_IMAGE_PIXELS = None
im = Image.open("ugm_poster.jpg").convert("RGB")
W, H = im.size
print("poster", W, H)
Wt, Ht = 16384, 8192
out = np.zeros((Ht, Wt, 3), dtype=np.uint8)
# ---------- 1. Equatorial Mercator body -> equirectangular ----------
BX0, BY0, BX1, BY1 = 311, 3752, 8906, 7082
body = np.asarray(im.crop((BX0, BY0, BX1 + 1, BY1 + 1)))
Hm, Wm, _ = body.shape
phimax = math.radians(57.0)
ymax = math.log(math.tan(math.pi / 4 + phimax / 2))
col_idx = np.round(np.linspace(0, Wm - 1, Wt)).astype(np.int64)
for R in range(Ht):
phi = math.radians(90.0 - 180.0 * R / (Ht - 1))
if phi > phimax or phi < -phimax:
continue # caps handled below
y = math.log(math.tan(math.pi / 4 + phi / 2))
frac = (ymax - y) / (2 * ymax)
r = min(max(int(round(frac * (Hm - 1))), 0), Hm - 1)
out[R] = body[r][col_idx]
# ---------- 2. Polar stereographic insets -> pole caps ----------
EDGE_COLAT = math.radians(35.0) # data edge at 55 deg lat
def make_scale(radius_px):
return radius_px / math.tan(EDGE_COLAT / 2)
def fill_cap(cx, cy, radius, hemisphere):
"""hemisphere: +1 = north, -1 = south."""
s = make_scale(radius)
m = radius + 30
bx0, by0 = int(cx - m), int(cy - m)
box = np.asarray(im.crop((bx0, by0, int(cx + m), int(cy + m))))
bh, bw, _ = box.shape
# output rows for this cap: |lat| >= 57
if hemisphere > 0:
rows = [R for R in range(Ht) if (90.0 - 180.0 * R / (Ht - 1)) >= 57.0]
else:
rows = [R for R in range(Ht) if (90.0 - 180.0 * R / (Ht - 1)) <= -57.0]
rows = np.array(rows)
phi = 90.0 - 180.0 * rows / (Ht - 1) # degrees
lam = -180.0 + 360.0 * np.arange(Wt) / (Wt - 1) # degrees
colat = 90.0 - np.abs(phi) # degrees, 0 at pole
r_px = s * np.tan(np.radians(colat) / 2.0) # (len_rows,)
lam_r = np.radians(lam) # (Wt,)
RR = r_px[:, None] # (rows,1)
SIN = np.sin(lam_r)[None, :] # (1,Wt)
COS = np.cos(lam_r)[None, :]
sx = cx + RR * SIN
if hemisphere > 0:
sy = cy + RR * COS
else:
sy = cy - RR * COS
lx = np.clip(np.round(sx - bx0).astype(np.int64), 0, bw - 1)
ly = np.clip(np.round(sy - by0).astype(np.int64), 0, bh - 1)
out[rows[:, None], np.arange(Wt)[None, :]] = box[ly, lx]
fill_cap(1725, 1827, 1420, +1) # North (left circle)
fill_cap(7477, 1826, 1420, -1) # South (right circle)
img = Image.fromarray(out)
img.save("moon_geologic_16k.jpg", quality=85)
img.resize((8192, 4096)).save("moon_geologic_8k.jpg", quality=88)
img.resize((2048, 1024)).save("moon_geologic_2k.jpg", quality=85)
print("wrote moon_geologic_16k/8k/2k.jpg (with poles)")12345678910111213141516171819202122232425262728body {padding: 2rem;font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;}h1 {font-size: 16px;margin-top: 0;}p {color: rgb(107, 114, 128);font-size: 15px;margin-bottom: 10px;margin-top: 5px;}.card {max-width: 620px;margin: 0 auto;padding: 16px;border: 1px solid lightgray;border-radius: 16px;}.card p:last-child {margin-bottom: 0;}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467* {margin: 0;padding: 0;box-sizing: border-box;}:root {--bg: #05060d;--panel-bg: rgba(16, 18, 34, 0.82);--panel-border: rgba(120, 140, 255, 0.18);--accent: #7c9cff;--accent-2: #ffd479;--text: #e8ecff;--text-dim: #9aa3c7;}html, body {height: 100%;overflow: hidden;background: var(--bg);color: var(--text);font-family: "Segoe UI", system-ui, -apple-system, sans-serif;}#app {position: relative;width: 100vw;height: 100vh;}/* ===== 3D scene ===== */#scene-container {position: absolute;inset: 0;z-index: 1;}#scene-container canvas {display: block;}#coord-readout {position: absolute;bottom: 18px;right: 22px;font-size: 12px;color: var(--text-dim);background: rgba(10, 12, 24, 0.55);padding: 6px 12px;border-radius: 8px;letter-spacing: 0.4px;pointer-events: none;font-variant-numeric: tabular-nums;}/* ===== Loading ===== */#loading {position: absolute;inset: 0;display: flex;flex-direction: column;align-items: center;justify-content: center;gap: 16px;color: var(--text-dim);font-size: 14px;letter-spacing: 0.5px;z-index: 5;transition: opacity 0.6s ease;}#loading.hidden {opacity: 0;pointer-events: none;}.spinner {width: 42px;height: 42px;border: 3px solid rgba(124, 156, 255, 0.2);border-top-color: var(--accent);border-radius: 50%;animation: spin 0.9s linear infinite;}@keyframes spin {to { transform: rotate(360deg); }}/* ===== Panel ===== */#panel {position: absolute;top: 22px;left: 22px;z-index: 10;width: 340px;max-width: calc(100vw - 44px);background: var(--panel-bg);border: 1px solid var(--panel-border);backdrop-filter: blur(14px);-webkit-backdrop-filter: blur(14px);border-radius: 18px;padding: 20px;box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);}.brand {display: flex;align-items: center;gap: 12px;margin-bottom: 18px;}#minimize-btn {margin-left: auto;width: 30px;height: 30px;flex-shrink: 0;display: flex;align-items: center;justify-content: center;background: rgba(124, 156, 255, 0.12);border: 1px solid rgba(124, 156, 255, 0.25);color: var(--text);border-radius: 9px;font-size: 20px;line-height: 1;cursor: pointer;transition: background 0.15s, transform 0.15s;}#minimize-btn:hover { background: rgba(124, 156, 255, 0.28); }#minimize-btn:active { transform: scale(0.92); }.logo {font-size: 34px;filter: drop-shadow(0 0 10px rgba(255, 212, 121, 0.5));}.brand-text h1 {font-size: 20px;font-weight: 700;letter-spacing: 0.3px;}.brand-text p {font-size: 12px;color: var(--text-dim);}/* ===== Search ===== */.search-box {position: relative;display: flex;gap: 8px;}#search-input {flex: 1;background: rgba(6, 8, 18, 0.7);border: 1px solid rgba(124, 156, 255, 0.25);border-radius: 12px;padding: 12px 14px;color: var(--text);font-size: 14px;outline: none;transition: border-color 0.2s, box-shadow 0.2s;}#search-input:focus {border-color: var(--accent);box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.15);}#search-input::placeholder {color: var(--text-dim);}#search-btn {background: linear-gradient(135deg, #7c9cff, #5b74e6);color: #fff;border: none;border-radius: 12px;padding: 0 18px;font-size: 14px;font-weight: 600;cursor: pointer;transition: transform 0.15s, filter 0.2s;}#search-btn:hover { filter: brightness(1.12); }#search-btn:active { transform: scale(0.96); }#suggestions {position: absolute;top: calc(100% + 6px);left: 0;right: 0;background: rgba(14, 16, 32, 0.98);border: 1px solid var(--panel-border);border-radius: 12px;overflow: hidden;z-index: 20;display: none;}#suggestions.show { display: block; }.suggestion {padding: 10px 14px;font-size: 13px;cursor: pointer;border-bottom: 1px solid rgba(255, 255, 255, 0.04);transition: background 0.12s;}.suggestion:last-child { border-bottom: none; }.suggestion:hover, .suggestion.active {background: rgba(124, 156, 255, 0.16);}.suggestion .s-coords {color: var(--text-dim);font-size: 11px;margin-top: 2px;}.hint {margin-top: 12px;font-size: 11.5px;color: var(--text-dim);line-height: 1.6;}.hint code {background: rgba(124, 156, 255, 0.14);padding: 1px 6px;border-radius: 5px;color: var(--accent);font-size: 11px;}/* ===== Result ===== */.result {margin-top: 16px;padding: 14px;background: rgba(255, 212, 121, 0.07);border: 1px solid rgba(255, 212, 121, 0.25);border-radius: 12px;animation: fadeIn 0.4s ease;}.result.hidden { display: none; }.result-name {font-size: 15px;font-weight: 700;color: var(--accent-2);}.result-coords {font-size: 12px;color: var(--text-dim);margin-top: 4px;font-variant-numeric: tabular-nums;}.result-desc {font-size: 12.5px;color: var(--text);margin-top: 8px;line-height: 1.5;}@keyframes fadeIn {from { opacity: 0; transform: translateY(6px); }to { opacity: 1; transform: translateY(0); }}/* ===== Quick list ===== */.quick-list { margin-top: 18px; }.quick-title {font-size: 11px;text-transform: uppercase;letter-spacing: 1px;color: var(--text-dim);margin-bottom: 10px;}#location-select {width: 100%;background: rgba(6, 8, 18, 0.7);border: 1px solid rgba(124, 156, 255, 0.25);color: var(--text);border-radius: 12px;padding: 11px 14px;font-size: 13.5px;outline: none;cursor: pointer;appearance: none;-webkit-appearance: none;background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237c9cff' stroke-width='3'><path d='M6 9l6 6 6-6'/></svg>");background-repeat: no-repeat;background-position: right 12px center;transition: border-color 0.2s, box-shadow 0.2s;}#location-select:focus {border-color: var(--accent);box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.15);}#location-select optgroup {color: var(--accent-2);background: #10122a;font-size: 12px;}#location-select option {color: var(--text);background: #0e1020;padding: 6px;}/* ===== Map toggle ===== */.map-toggle { margin-top: 18px; }.map-toggle label {font-size: 11px;text-transform: uppercase;letter-spacing: 1px;color: var(--text-dim);display: block;margin-bottom: 8px;}.toggle-buttons {display: flex;gap: 8px;}.toggle-btn {flex: 1;background: rgba(6, 8, 18, 0.6);border: 1px solid rgba(124, 156, 255, 0.2);color: var(--text-dim);border-radius: 10px;padding: 8px;font-size: 12.5px;cursor: pointer;transition: all 0.15s;}.toggle-btn.active {background: rgba(124, 156, 255, 0.22);color: var(--text);border-color: var(--accent);}.reference {margin-top: 18px;}.reference label {font-size: 11px;text-transform: uppercase;letter-spacing: 1px;color: var(--text-dim);display: block;margin-bottom: 6px;}.reference a {display: block;font-size: 12px;line-height: 1.5;color: var(--accent);text-decoration: none;padding: 9px 12px;background: rgba(124, 156, 255, 0.1);border: 1px solid rgba(124, 156, 255, 0.2);border-radius: 10px;transition: background 0.15s;}.reference a + a {margin-top: 7px;}.reference a:hover {background: rgba(124, 156, 255, 0.22);}.footer-note {margin-top: 18px;font-size: 10.5px;color: var(--text-dim);text-align: center;line-height: 1.5;}.credit {margin-top: 12px;padding-top: 12px;border-top: 1px solid rgba(124, 156, 255, 0.14);text-align: center;font-size: 12px;font-weight: 600;letter-spacing: 0.3px;color: var(--accent);}/* ===== Minimize / expand ===== */#panel {transform-origin: top left;transition: opacity 0.25s ease, transform 0.25s ease;}#panel.collapsed {opacity: 0;transform: scale(0.92);pointer-events: none;}#expand-btn {position: absolute;top: 22px;left: 22px;z-index: 10;display: none;align-items: center;gap: 9px;background: var(--panel-bg);border: 1px solid var(--panel-border);backdrop-filter: blur(14px);-webkit-backdrop-filter: blur(14px);color: var(--text);border-radius: 14px;padding: 10px 16px;font-size: 15px;font-weight: 700;cursor: pointer;box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);transition: filter 0.15s, transform 0.15s;}#expand-btn .logo {font-size: 22px;filter: drop-shadow(0 0 8px rgba(255, 212, 121, 0.5));}#expand-btn:hover { filter: brightness(1.12); }#expand-btn:active { transform: scale(0.96); }#expand-btn.show { display: flex; }/* ===== Responsive ===== */@media (max-width: 640px) {#panel {top: 12px;left: 12px;right: 12px;width: auto;padding: 16px;}.map-toggle { display: none; }}
.gitattributes+8
app.jsAdded+723
index.html+120-19
locations.jsAdded+246
lroc_color_poles_16k.tifAdded
Large File Pointer Details
- SHA256: dbff4356479764d89f9fd7722140043eddbc2cafbad4dec5950858e2df77ac54
- Pointer size: 134 Bytes
- Size of remote file: 187 MB
moon_color_16k.jpgAdded

Large File Pointer Details
- SHA256: 6265e2e43447bc4705e4025babb0f9f60e71947b58bb48d012c2f4417f1fef34
- Pointer size: 133 Bytes
- Size of remote file: 20.2 MB
moon_color_2k.jpgAdded

Large File Pointer Details
- SHA256: 35a60c11992d875cb6368fc55d3efe41150d4fdb047c3a4f8a86fa120b0d4cb7
- Pointer size: 131 Bytes
- Size of remote file: 379 kB
moon_color_8k.jpgAdded

Large File Pointer Details
- SHA256: 39c1be9cb9a010bdccd6bcd50b1e75fa8e17059e849c5625526ae3c6fbb6272e
- Pointer size: 132 Bytes
- Size of remote file: 6.21 MB
moon_colorful.jpgAdded

Large File Pointer Details
- SHA256: f146e431cb9f9d258b415d3f80bcc2bc67df4d6b9da695c5d7a62a1e66d30d1f
- Pointer size: 133 Bytes
- Size of remote file: 20.7 MB
moon_geologic_16k.jpgAdded

Large File Pointer Details
- SHA256: c68a8a73508b2734f176517bace680d01f24914c9eed5c594aa119d2f2807d57
- Pointer size: 133 Bytes
- Size of remote file: 54.8 MB
moon_geologic_2k.jpgAdded

Large File Pointer Details
- SHA256: 60b9f5fa424737bc79103d4f254e1e3d49a90f07a905c96acf08c368cdd93901
- Pointer size: 132 Bytes
- Size of remote file: 1.03 MB
moon_geologic_8k.jpgAdded

Large File Pointer Details
- SHA256: 568e154ba6607387294d481924e6c2edf468c113df0b1f32d4ac313b54ae11b4
- Pointer size: 133 Bytes
- Size of remote file: 16.3 MB
reproject.pyAdded+94
style.css+467-28