A super easy-to-use tool for generate 3D Gazebo terrain using real-world elevation and satellite data.
- Real-World Terrain Generation: Generate 3D Gazebo worlds using actual elevation data and satellite images of any location on Earth.
- Configurable Spawn Location: Change the spawn location using interactive UI marker within the region of interest
- Configurable Output: Flexible output paths via environment variables for different deployment scenarios
- Customizable Resolution: Adjustable tile resolution.
- Complete World Generation: Generates the entire model with no hassle out of the box
It's recommended to use a virtual environment to avoid dependency conflicts:
python3 -m venv terrain_generator
source terrain_generator/bin/activate
Make sure your virtual environment is active, then install all required Python packages using:
pip install -r requirements.txt
You can customize where Gazebo Models and World are saved using environment variables:
export GAZEBO_MODEL_PATH="~/Desktop/gazebo_models"
export GAZEBO_WORLD_PATH="~/Desktop/gazebo_models/worlds"
Default Location: If no environment variable is set, worlds are saved to:
Models saved in **~/gazebo_terrian_generator/output/gazebo_terrian/**
World files in **~/gazebo_terrian_generator/output/gazebo_terrian/worlds**
Generated model follow this structure:
<GAZEBO_MODEL_PATH>/
├── world_name/
│ ├── model.sdf # Gazebo model definition
│ ├── model.config # Model configuration
│ ├── world_name.sdf # Gazebo world file
│ └── textures/
│ ├── world_name_height_map.tif # Elevation heightmap
│ └── world_name_aerial.png # Satellite imagery texture
<GAZEBO_WORLD_PATH>/
├──world_name.sdf
├──world_name_1.sdf
├──world_name_2.sdf
-
Navigate to gazebo_terrian_generator and start the applciation.
source terrain_generator/bin/activate python server.py
-
Access the Web Interface: Open your web browser and navigate to
http://localhost:8080
-
Generate Your World:
- Search for any location on Earth
- Draw a rectangular region of interest
- Place launch pad marker at desired spawn location
- Configure settings (zoom level, map source)
- Click "Generate Terrain" to create your world
-
Output Location: Generated worlds are saved to the configured path (see Environment Variables section above)
-
Export the gazebo model path:
export GZ_SIM_RESOURCE_PATH=$GZ_SIM_RESOURCE_PATH:<path_to_your_gazebo_worlds>
-
Run Gazebo with your world:
gz sim your_world_name/your_world_name.sdf
Note: Replace <path_to_your_gazebo_worlds>
with the actual path where your worlds are saved.
Test the installation with provided sample worlds:
-
Export the sample gazebo model path:
export GZ_SIM_RESOURCE_PATH=$GZ_SIM_RESOURCE_PATH:~/gazebo_terrian_generator/sample_worlds
-
Launch sample world:
gz sim prayag/prayag.sdf
A free api key is being used in the repo if it gets limited then please feel free to create your own API key from official MapBox's website and replace it in the configuration file
Downloading map tiles is subject to the terms and conditions of the tile provider. Some providers such as Google Maps have restrictions in place to avoid abuse, therefore before downloading any tiles make sure you understand their TOCs. I recommend not using Google, Bing, and ESRI tiles in any commercial application without their consent.
This project uses work of Ali Ashraf.