Google Earth 3D Tiles โ Voxels
Download Google Earth 3D tiles around any location and convert them to voxel data using pure Node.js. No game engines or external dependencies required beyond Node.js packages.
- ๐ Geocoding Support: Convert addresses to coordinates automatically
- ๐ฆ 3D Tile Download: Fetch Google Earth 3D tiles in GLB format
- ๐ฎ Voxelization: Convert 3D meshes to colored voxel grids
- ๐จ Texture Sampling: Extract colors from mesh textures
- ๐ JSON Output: Export voxel data in a simple JSON format
- ๐ผ๏ธ Visualizer: Web-based tool to preview voxel data
- Node.js (v18 or later recommended for native
fetchsupport) - Google API Key with access to:
- Geocoding API (for address โ lat/lng conversion)
- Google Earth 3D Tiles API / Map Tiles API
-
Clone this repository:
git clone <repository-url> cd voxel-earth
-
Install dependencies:
npm install
This installs:
three- 3D library for loading GLB filesaxios- HTTP client for API requestssharp- Image processing for texture decodingdraco3d- Draco mesh compression supportjpeg-js- JPEG image decodingp-queue- Parallel download queueyargs- Command-line argument parsing
node run_pipeline.js --key YOUR_API_KEY --location "Eiffel Tower, Paris" --radius 50 --out ./output| Argument | Required | Description |
|---|---|---|
| --key YOUR_API_KEY \ | ||
| --location "Golden Gate Bridge" \ | ||
| --radius 30 \ | ||
| --out ./test \ | ||
| --resolution 100 |
The pipeline consists of three main stages:
If you provide a --location instead of coordinates, the script uses the Google Geocoding API to convert the address into latitude/longitude.
- Queries the Google Earth 3D Tiles API to get the tileset hierarchy
- Performs breadth-first search to find tiles within the specified radius
- Downloads GLB files for each intersecting tile
- Applies rotation transforms using
rotateUtils.cjsto align tiles to a common origin - Saves rotated GLB files to
<output>/tiles/
- Loads each GLB file using Three.js
GLTFLoader - Decodes textures from the mesh using
sharpandjpeg-js - Performs ray-casting voxelization at the specified resolution
- Samples colors from textures for each voxel
- Writes voxel data to
<output>/voxels/*.json
The pipeline creates two subdirectories in your output folder:
output/
โโโ tiles/ # Rotated GLB files
โ โโโ abc123...glb
โ โโโ def456...glb
โ โโโ ...
โโโ voxels/ # Voxel JSON files
โโโ abc123..._voxels.json
โโโ def456..._voxels.json
โโโ ...
Each voxel JSON file contains:
{
"voxels": [
{
"x": 0, "y": 5, "z": 10, // Grid coordinates
"wx": 4.2, "wy": -1.5, "wz": 0.3, // World coordinates (meters)
"r": 142, "g": 128, "b": 105, "a": 255 // RGBA color
},
// ... more voxels
]
}- Grid coordinates (
x,y,z): Integer indices from 0 to resolution-1 - World coordinates (
wx,wy,wz): Relative positions in meters from the origin tile - Color (
r,g,b,a): RGBA values (0-255)
The repository includes a web-based visualizer to preview voxel data:
- Open
visualizer.htmlin a web browser - Load a voxel JSON file from the output directory
- Interact with the 3D view:
- Left mouse: Rotate
- Right mouse: Pan
- Scroll: Zoom
- Go to the Google Cloud Console
- Create a new project (or select an existing one)
- Enable the following APIs:
- Geocoding API (for address lookups)
- Map Tiles API (for 3D tile access)
- Go to APIs & Services โ Credentials
- Click Create Credentials โ API Key
- (Optional) Restrict the key to only the APIs you need
Note: The Google Earth 3D Tiles API may require billing to be enabled on your Google Cloud project, even if you stay within the free tier.
This warning is normal. It appears because Three.js logs when textures are decoded from binary data. The textures are still processed correctly by sharp and jpeg-js.
The Elevation API is not required for the pipeline to work. The script assumes elevation = 0 if it can't fetch it. You can safely ignore this warning.
- Check that your API key has access to the Map Tiles API / Google Earth 3D Tiles API
- Verify billing is enabled on your Google Cloud project
- Try a well-known location like "Eiffel Tower, Paris" to confirm geocoding works
- Increase the
--radiusvalue (try 100-200 meters)
- Reduce
--resolution(try 100 or 150 instead of 200) - Reduce
--radiusto download fewer tiles - Close other applications to free up RAM
- Check your internet connection
- The tile download step can take several minutes for large areas
- Monitor the console output for progress messages
voxel-earth/
โโโ run_pipeline.js # Main entry point
โโโ tile_downloader.js # Download Google Earth tiles
โโโ voxelize_tiles.js # Voxelization orchestrator
โโโ voxelizer.worker.js # Voxelization worker logic
โโโ rotateUtils.cjs # Tile rotation utilities
โโโ visualizer.html # Web-based voxel viewer
โโโ package.json # Node.js dependencies
โโโ README.md # This file
Higher resolutions produce denser voxel grids but increase memory usage and processing time:
# Low resolution (faster, less detail)
node run_pipeline.js --key KEY --location "Paris" --radius 50 --out ./out --resolution 50
# High resolution (slower, more detail)
node run_pipeline.js --key KEY --location "Paris" --radius 50 --out ./out --resolution 300The tile downloader uses 4 parallel workers by default. This is set in run_pipeline.js line 140:
const tileArgs = ['--key', key, '--lat', String(lat), '--lng', String(lng), '--radius', String(radius), '--out', tilesDir, '--parallel', '4'];You can modify the '4' value to increase/decrease parallelism.
ISC
- Google Earth 3D Tiles: Data ยฉ Google
- Three.js: 3D library for WebGL
- Sharp: High-performance image processing
Q: Can I use this offline?
A: No, the pipeline requires internet access to download tiles from Google's servers.
Q: What coordinate system is used?
A: World coordinates are in ECEF (Earth-Centered, Earth-Fixed) meters, rotated and translated to a local origin based on the first tile.
Q: Can I import the voxels into Minecraft, Minetest, or other games?
A: The JSON output is game-agnostic. You'll need to write a custom importer for your target platform. The repository previously included a Luanti/Minetest mod, but it has been removed to focus on the Node.js pipeline.
Q: How accurate are the voxels?
A: Accuracy depends on the resolution parameter and the quality of Google's 3D tiles. Higher resolutions produce more detailed voxels but take longer to process.
Q: Why are there warnings about textures?
A: Three.js logs warnings when loading textures from binary data. These can be safely ignored - the textures are still processed correctly.
This tool is intended for educational and debugging purposes only.
If you are using Google Earth 3D Tiles, please be aware of the following restrictions from Google's Terms of Service:
- No Downloading or Storing: You are not permitted to download, cache, or store Google 3D Tiles data beyond temporary caching for real-time visualization purposes.
- Visualization Only: Google 3D Tiles may only be used for real-time visualization within applications. Permanent storage, offline use, or redistribution of tile data is prohibited.
- Attribution Required: You must display appropriate Google attribution when using their tiles.
By using this tool with Google's 3D Tiles API, you accept full responsibility for complying with Google's Terms of Service and the Maps Platform Acceptable Use Policy.
If you are using 3D Tiles from other providers (Cesium Ion, custom tilesets, etc.), please ensure you review and comply with their respective Terms of Service and licensing agreements.
The authors of this tool are not responsible for any misuse or Terms of Service violations.
Contributions are welcome! Please open an issue or pull request on GitHub.