Loading Mars…
MarsGIS
Full globe
npm package · open source

mars-globe

A real 3D Mars globe for your web app, in one line. The planet behind this text is the package.

npm install mars-globe cesium
import { createMarsGlobe } from 'mars-globe';
createMarsGlobe('map', { defaultBasemap: 'viking' });
Mars IAU 2000 shape4 NASA basemapsNo Ion token0 dependencies5 kB
Scroll to fly across Mars and see MarsGIS, the project it came from
01 · The problem

Mars data is hard to reach

  • 1
    Locked in archives. NASA's CRISM images sit in the Planetary Data System. One scene has 489 spectral bands for every pixel.
  • 2
    Desktop-only tools. Mineral mapping usually means desktop software, scripts and manual reprojection.
  • 3
    Web maps assume Earth. CesiumJS starts with the Earth, its atmosphere and an Ion token. Setting it up for Mars is fiddly.
02 · Meet MarsGIS

From NASA archive to mineral map, in the browser

The globe is now over Nili Fossae, one of the most studied mineral regions on Mars. The orange box is a real CRISM observation, frt00003e12.

  • 1
    Find a scene in the catalogue, or fetch new ones live from NASA's ODE archive.
  • 2
    Choose a reference mineral: olivine, carbonate or clay.
  • 3
    Run SAM, the Spectral Angle Mapper, on every pixel.
  • 4
    View the result as map tiles, then export COG files with a provenance record.
03 · The app

The MarsGIS workspace

MarsGIS app: catalogue on the left, a Mg-carbonate candidate layer over Nili Fossae, results on the right
Mg-carbonate candidates over Nili Fossae: 144 candidate pixels, 6.3% of valid pixels.

SAM finds candidate spectral matches, not confirmed deposits. Every result says so and keeps the raw angle map next to the mask.

04 · Validated

Tested on real Mars data

On the real CRISM scene, MarsGIS passed three checks against published geology (Ehlmann et al. 2008, Mustard et al. 2009): carbonate is patchy, not everywhere; no mineral wins every pixel; olivine is broader than carbonate.

489bands in the cube
238bands used, 1000–2600 nm
3 / 3validation checks passed

On the synthetic test cube, carbonate and olivine were found with precision, recall and IoU of 1.0.

05 · Coordinates done right

Every layer lines up

MarsGIS uses the official IAU 2000 Mars system and NASA Trek's 2 × 1 geographic tile grid everywhere. Basemaps, results, footprints and clicks align with no reprojection.

We checked it against live NASA tiles at the four pins on the globe: Jezero, Gale, Olympus Mons and Nili Fossae. All four returned HTTP 200 and the maths passed.

06 · The stack

Chosen to stay simple

Frontend: React 19, TypeScript and Vite, with one persistent CesiumJS viewer. The browser never does raster maths.

Backend: Python 3.12 and FastAPI, because GDAL, rasterio and the spectral tools live in Python. rio-tiler turns results into map tiles on a Mars grid.

Engine: vectorised numpy SAM that writes Cloud Optimized GeoTIFFs plus provenance.json.

CesiumJSReact 19FastAPIrio-tilernumpyCOGOpenAPI
07 · For developers

Add Mars to your app in one line

The globe on this page is mars-globe, the package I extracted from MarsGIS. It sets up the Mars ellipsoid, NASA Trek basemaps and tiling for you. No Ion token, zero dependencies, typed, 5 kB standalone.

npm install mars-globe cesium
import { createMarsGlobe } from 'mars-globe';

const globe = createMarsGlobe('map', {
  defaultBasemap: 'viking',
});
globe.setBasemap('mola');
08 · Built-in basemaps

Four NASA maps. Try them.

Click one: the globe behind this text switches, the same way globe.setBasemap(id) does in your app.

09 · Run the full app

The whole of MarsGIS in one container

The release image on GitHub Container Registry holds the web app, the API, the SAM engine, a SQLite database and a sample cube. It runs on Intel and ARM.

# start MarsGIS
docker run -d -p 8080:8080 \
  -v marsgis-data:/data \
  ghcr.io/aaron43210/marsgis:latest

# open http://localhost:8080
curl localhost:8080/api/health
Your turn

Build something on Mars

One install, and your app has the real Mars.

npm install mars-globe cesium