Streamlined CLI for OSM Vector Tile Generation
Generate beautiful vector tiles and MapLibre GL JS styles from OpenStreetMap data with smart caching and optimized feature extraction.
- πΊοΈ OSM Integration: Direct OpenStreetMap data processing with intelligent tag handling
- π¨ Beautiful Styles: Palette-based MapLibre GL JS style generation
- β‘ Smart Caching: Avoid redundant processing with intelligent cache management
- π High Performance: Optimized processing with parallel feature extraction
- π οΈ Professional Tools: Built on industry-standard tools (osmium, tippecanoe)
- π¦ Production Ready: MBTiles output compatible with all major mapping platforms
- ποΈ 50+ Feature Types: Comprehensive OSM feature support across 9 categories
Install system dependencies (macOS):
brew install osmium-tool tippecanoe gdalFor other platforms, see Installation Guide.
# Clone repository
git clone https://github.com/username/tilecraft.git
cd tilecraft
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install tilecraft
pip install -e .# Generate tiles for Colorado rivers and forests
tilecraft generate \
--bbox "-109.2,36.8,-106.8,38.5" \
--features "rivers,forest,water" \
--palette "subalpine dusk" \
--name "colorado_nature"
# Quick urban mapping
tilecraft generate \
--bbox "-122.5,37.7,-122.3,37.8" \
--features "roads,buildings,parks,restaurants" \
--palette "urban midnight" \
--name "san_francisco"
# Comprehensive regional mapping
tilecraft generate \
--bbox "-105.5,39.5,-105.0,40.0" \
--features "rivers,lakes,mountains,forest,roads,buildings" \
--palette "alpine blue" \
--name "colorado_comprehensive"Generate Vector Tiles
tilecraft generate [OPTIONS]
Required:
--bbox TEXT Bounding box as 'west,south,east,north'
--features TEXT Comma-separated feature types (see 'tilecraft features')
--palette TEXT Style palette mood (e.g., 'subalpine dusk')
Optional:
--output PATH Output directory (default: output)
--name TEXT Project name for file naming
--min-zoom INT Minimum zoom level (default: 0)
--max-zoom INT Maximum zoom level (default: 14)
--no-cache Disable caching
--preview Generate preview after tile creation
--verbose, -v Verbose output
--quiet, -q Quiet modeExplore Available Features
tilecraft features [OPTIONS]
Options:
--category TEXT Filter by category (water, natural, transportation, etc.)
--search TEXT Search feature names and descriptions
--count INT Number of features to show (default: 50)Check System Dependencies
tilecraft check [OPTIONS]
Options:
--verbose, -v Show detailed dependency information
--fix Show installation commands for missing dependenciesDiscover Features
# See all 50+ available features
tilecraft features
# Find water-related features
tilecraft features --search "water"
# See transportation options
tilecraft features --category "transportation"
# Explore natural features
tilecraft features --category "natural"Natural Features Mapping
tilecraft generate \
--bbox "-120.5,35.0,-120.0,35.5" \
--features "rivers,forest,water,wetlands,mountains,beaches" \
--palette "pacific northwest" \
--name "big_sur_nature"Urban Planning Analysis
tilecraft generate \
--bbox "-74.1,40.6,-73.9,40.8" \
--features "roads,buildings,parks,schools,hospitals,restaurants" \
--palette "metropolitan" \
--max-zoom 16 \
--name "manhattan_urban"Infrastructure Mapping
tilecraft generate \
--bbox "-118.5,34.0,-118.0,34.5" \
--features "roads,railways,airports,power_lines,bridges" \
--palette "industrial" \
--name "la_infrastructure"Recreational Planning
tilecraft generate \
--bbox "-106.0,39.0,-105.5,39.5" \
--features "parks,playgrounds,sports_fields,golf_courses,mountains,rivers" \
--palette "recreational" \
--name "denver_recreation"output/
βββ tiles/
β βββ project_name.mbtiles # Vector tiles
βββ styles/
β βββ project_name-style.json # MapLibre GL JS style
βββ data/
β βββ rivers.geojson # Extracted feature data
β βββ buildings.geojson
β βββ roads.geojson
β βββ schema.json # AI-generated schema
βββ cache/
β βββ *.osm.pbf # Cached OSM data
βββ README.md # Output documentation
macOS:
brew install osmium-tool tippecanoe gdalUbuntu/Debian:
sudo apt-get update
sudo apt-get install osmium-tool tippecanoe gdal-bin python3-gdalWindows (via conda):
conda install -c conda-forge osmium-tool tippecanoe gdal# From PyPI (when published)
pip install tilecraft
# Development installation
git clone https://github.com/username/tilecraft.git
cd tilecraft
pip install -e .[dev]Copy .env.example to .env and configure:
# Processing Configuration
TILECRAFT_CACHE_ENABLED=trueπΊοΈ 52 Feature Types Available Across 8 Categories:
- Water Features (6): rivers, water, lakes, wetlands, waterways, coastline
- Natural Features (8): forest, woods, mountains, peaks, cliffs, beaches, glaciers, volcanoes
- Land Use (7): parks, farmland, residential, commercial, industrial, military, cemeteries
- Transportation (8): roads, highways, railways, airports, bridges, tunnels, paths, cycleways
- Built Environment (5): buildings, churches, schools, hospitals, universities
- Amenities (6): restaurants, shops, hotels, banks, fuel_stations, post_offices
- Recreation (5): playgrounds, sports_fields, golf_courses, stadiums, swimming_pools
- Infrastructure (5): power_lines, wind_turbines, solar_farms, dams, barriers
- Administrative (2): boundaries, protected_areas
β¨ All Features Fully Supported with:
- Optimized OSM Overpass queries
- Smart tag extraction and filtering
- Automatic geometry validation
- Efficient caching and processing
To see all available features:
# List all features by category
tilecraft features
# Search for specific features
tilecraft features --search "water"
# Filter by category
tilecraft features --category "transportation"subalpine dusk- Muted mountain colorsdesert sunset- Warm earth tonespacific northwest- Deep greens and bluesurban midnight- High contrast city themearctic- Cool blues and whitestropical- Vibrant greens and blues
Tilecraft streamlines OSM processing through:
- Smart Feature Extraction: Efficiently extracts specific feature types using optimized osmium filters
- Intelligent Schema Generation: Creates well-structured tile schemas based on feature types and zoom requirements
- Optimized Style Creation: Generates MapLibre styles with carefully chosen color palettes and rendering rules
- Advanced Caching: Prevents redundant downloads and processing for faster iteration
- Graceful Resource Management: Proper cleanup prevents hanging and ensures smooth operation
# Check all dependencies and get installation help
tilecraft check --verbose --fixSolution: Install tilecraft in development mode
# Make sure you're in the tilecraft directory and virtual environment is active
source .venv/bin/activate
pip install -e .Solution: Use the generate subcommand
# β Wrong - missing 'generate'
tilecraft --bbox "..." --features "..." --palette "..."
# β
Correct - include 'generate' subcommand
tilecraft generate --bbox "..." --features "..." --palette "..."Solutions:
# macOS
brew install tippecanoe
# Ubuntu/Debian
sudo apt-get install tippecanoe
# Check installation
tippecanoe --versionSolution: This has been fixed! The CLI now properly cleans up resources and exits gracefully.
Solution: Use correct format: west,south,east,north
# β
Correct format
tilecraft generate --bbox "-109.2,36.8,-106.8,38.5" --features "rivers" --palette "subalpine dusk"
# β Common mistakes:
# Missing quotes, wrong order, extra spacesSolution: Check available features
# See all available features
tilecraft features
# Search for specific features
tilecraft features --search "water"
# Check spelling - feature names are case-sensitive- Large regions: Use
--max-zoom 12instead of 14 - Memory issues: Process smaller bounding boxes
- Slow processing: Close other applications, use SSD storage
- Cache: Use
--no-cacheif running low on disk space
git clone https://github.com/username/tilecraft.git
cd tilecraft
# Install with development dependencies
pip install -e .[dev]
# Install pre-commit hooks
pre-commit install
# Run tests
pytest
# Format code
black src/ tests/
ruff check src/ tests/tilecraft/
βββ src/tilecraft/
β βββ cli.py # Command-line interface
β βββ core/ # OSM processing
β βββ ai/ # AI integration
β βββ models/ # Data models
β βββ utils/ # Utilities
βββ tests/ # Test suite
βββ docs/ # Documentation
βββ examples/ # Usage examples
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make changes and add tests
- Run tests:
pytest - Format code:
black .andruff check . - Commit changes:
git commit -m "Description" - Push and create Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenStreetMap contributors
- Tippecanoe by Mapbox
- Osmium by OSM developers
- MapLibre GL JS community
- π§ System Check:
tilecraft check --fixfor installation help - πΊοΈ Feature Discovery:
tilecraft featuresto explore options - π Issues: Check existing issues or create new one
- π¬ Discussions: Community support and questions
"The best way to find out if you can trust somebody is to trust them." β Ernest Hemingway