Discover hidden gems near you using AI-powered location analysis
A Python application that intelligently identifies and rates underrated locations (hidden gems) in your area using OpenRouter API for AI analysis and OpenStreetMap for location data.
- Features
- Requirements
- Installation
- Quick Start
- Usage
- Project Structure
- Configuration
- Testing
- Development
- Troubleshooting
- API Reference
- Contributing
- License
- π€ AI-Powered Analysis - Uses OpenRouter API with advanced LLMs to intelligently identify underrated locations
- πΊοΈ OpenStreetMap Integration - Searches nearby POIs using Overpass API
- π Smart Geocoding - Converts addresses to coordinates with Nominatim
- β Dynamic Scoring - Rates locations based on multiple criteria (visibility, tags, category)
- πΎ Result Export - Saves findings to timestamped JSON with metadata
- βοΈ Highly Configurable - Customize categories, scoring, and API settings
- π§ͺ Comprehensive Tests - Includes unit tests and integration tests
- π‘ Error Handling - Robust error recovery with fallback analysis
- Python: 3.8 or higher
- OS: Windows, macOS, or Linux
- API Key: OpenRouter account (free tier available)
- Internet: Required for API calls
See requirements.txt for full list:
requests- HTTP clientgeopy- Geocoding & distance calculation
Note: The app reads
OPENROUTER_API_KEYfrom the environment usingos.getenv. A local.envfile is optional and does not requirepython-dotenvunless you add explicit loading support.
git clone <repo-url>
cd Guide# Windows
python -m venv venv
venv\Scripts\activate
# macOS/Linux
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txt- Sign up at OpenRouter
- Copy your API key from the dashboard
Create/edit .env file in project root:
OPENROUTER_API_KEY=your-actual-api-key-hereAlternative: Set as environment variable
# Windows (PowerShell)
$env:OPENROUTER_API_KEY="your-key-here"
# Windows (CMD)
set OPENROUTER_API_KEY=your-key-here
# macOS/Linux
export OPENROUTER_API_KEY=your-key-herepython src/guide_app.pyπ Enter your location (address or city): San Francisco
π Search radius in meters (default 5000): [press Enter or type 5000]
β Minimum score (0-1, default 0.6): [press Enter or type 0.6]
- Displays top underrated locations found
- Shows location name, category, score, and distance
- Automatically saves results to timestamped JSON file
π TOP UNDERRATED LOCATIONS NEAR YOU π
==============================================================================
1. Hidden River Trail
ποΈ Category: Water
ββββ Score: 0.85/1.0
π Distance: 2.3km away
π‘ Why underrated: Natural waterfall with minimal tourism infrastructure
π Potential: Excellent discovery opportunity
Example 1: Find hidden gems in your city
python src/guide_app.py
# Enter: New York
# Radius: 3000 (3km)
# Min Score: 0.7python src/guide_app.py
# Enter: Los Angeles
# Radius: 10000 (10km)
# Min Score: 0.5import sys
sys.path.insert(0, 'src')
from guide_app import UnderratedGuideApp
app = UnderratedGuideApp(api_key="your-key")
locations = app.find_underrated_locations(
user_address="Seattle",
radius=5000,
min_score=0.6
)
for loc in locations:
print(f"{loc['name']}: {loc['score']:.2f} ({loc['distance']:.0f}m away)")Guide/
βββ src/
β βββ guide_app.py # Main application
β
βββ tests/
β βββ test_guide_app.py # Unit & integration tests
β
βββ config/
β βββ config.json # API settings & categories
β
βββ web/
β βββ index.html # Web interface landing page
β βββ about.html # About page
β βββ explore.html # Explore interface
β βββ saved.html # Saved locations page
β βββ about.js # Page logic for About
β βββ explore.js # Page logic for Explore
β βββ saved.js # Page logic for Saved
β βββ nav.js # Navigation helper
β βββ styles.css # Styling
β
βββ docs/
β βββ README.md # Project documentation
β
βββ assets/ # Media assets and videos
βββ .env # Environment variables (optional)
βββ requirements.txt # Python dependencies
βββ STRUCTURE.md # Structure reference
βββ GIT_PUSH_CHECKLIST.md # Git push guide
Directory Purposes:
- src/ - Production code (main application logic)
- tests/ - Test suite (unit & integration tests)
- config/ - Configuration files (API settings, categories)
- web/ - Web UI files (optional frontend)
- docs/ - Additional documentation
{
"api": {
"provider": "openrouter",
"base_url": "https://openrouter.ai/api/v1",
"model": "openai/gpt-4-turbo-preview",
"temperature": 0.3,
"max_tokens": 500,
"headers": {
"HTTP-Referer": "https://your-site.com",
"X-Title": "Underrated Locations Guide"
}
},
"search_settings": {
"default_radius": 5000,
"default_min_score": 0.6,
"max_results": 10
},
"categories": {
"natural_sights": ["river", "waterfall", "lake", "peak"],
"viewpoints": ["viewpoint", "lookout", "vista"],
"water_features": ["river", "waterfall", "lake"],
"hidden_gems": ["park", "garden", "trail", "beach"]
},
"boost_factors": {
"natural": 0.1,
"water": 0.15,
"viewpoint": 0.12,
"hidden_gem": 0.2
}
}Key Settings:
| Setting | Default | Purpose |
|---|---|---|
default_radius |
5000m | Search area size |
default_min_score |
0.6 | Quality threshold |
max_results |
10 | Results limit |
temperature |
0.3 | AI creativity (0=deterministic, 1=creative) |
max_tokens |
500 | Response length |
# OpenRouter API Configuration
OPENROUTER_API_KEY=sk_your_key_here
# Optional: Override defaults
DEFAULT_RADIUS=5000
DEFAULT_MIN_SCORE=0.6
MAX_RESULTS=10python tests/test_guide_app.pyπ§ͺ Running Guide App Tests
========================================
Testing configuration loading...
β Configuration loaded successfully
Testing location detection...
Test 1: River β water
Test 2: Lookout β viewpoint
Testing fallback analysis...
β Analysis completed
π Test Results: 3/3 tests passed
β
All tests passed! The app is ready to use.
- β Configuration loading
- β Location type detection
- β Fallback analysis (when API fails)
- β Scoring calculations
- β Geocoding
Edit config/config.json:
"categories": {
"new_category": ["tag1", "tag2", "tag3"]
}Edit src/guide_app.py, function calculate_underrated_score():
def calculate_underrated_score(self, location_data, analysis):
# Your scoring logic here
return scoreAdd test function to tests/test_guide_app.py:
def test_new_feature():
"""Test description"""
app = UnderratedGuideApp()
# Your test code
assert result == expected- Follow PEP 8 style guide
- Add docstrings to all functions
- Keep functions focused (<50 lines)
- Use type hints where possible
- Comment complex logic
Cause: Overpass API header mismatch
Solution: App automatically sends correct headers
# Already included:
headers = {
"User-Agent": "UnderratedGuideApp/1.0",
"Accept": "application/json"
}Check 1: Verify .env exists in project root
ls .env # or: dir .env (Windows)Check 2: Verify API key is set
echo $env:OPENROUTER_API_KEY # Windows
echo $OPENROUTER_API_KEY # macOS/LinuxCheck 3: Verify key format (should start with sk_)
- Increase search radius (try 10000 instead of 5000)
- Lower minimum score threshold (try 0.4 instead of 0.6)
- Verify location address is valid
- Check internet connection
Windows-specific: UTF-8 encoding issue
Solution: Already fixed with encoding wrapper in tests
Solution: Ensure correct Python path
import sys
sys.path.insert(0, 'src')
from guide_app import UnderratedGuideAppInitialize the application.
app = UnderratedGuideApp(api_key="your-key")Main method to find locations.
locations = app.find_underrated_locations(
user_address="San Francisco",
radius=5000,
min_score=0.6
)Returns: List of location dictionaries with:
name- Location namescore- Underrated score (0-1)category- Location typedistance- Distance in metersreason- Why it's underratedcoordinates- [latitude, longitude]
Display results in terminal.
app.display_results(locations)Save results to JSON file.
app.save_to_file(locations) # Auto-generated filename
app.save_to_file(locations, "my_locations.json")- Fork Repository
git clone https://github.com/yourusername/3d-earth-explorer.git
cd 3d-earth-explorer- Create Feature Branch
git checkout -b feature/your-feature-name- Make Changes & Test
# Make your changes
python tests/test_guide_app.py # Ensure tests pass- Commit Changes
git add -A
git commit -m "feat: add your feature description"- Push & Create Pull Request
git push origin feature/your-feature-name
# Then create PR on GitHub- Write clear, descriptive commit messages
- Add tests for new features
- Update documentation as needed
- Follow PEP 8 style guide
- Keep pull requests focused
- Check issues first
- Provide reproducible steps
- Include error messages/logs
- Specify Python version & OS
This project is licensed under the MIT License - see LICENSE file for details.
- β Commercial use allowed
- β Modification allowed
- β Distribution allowed
- β Private use allowed
β οΈ No warranty providedβ οΈ License and copyright required
- STRUCTURE.md - Project structure guide
- GIT_PUSH_CHECKLIST.md - Git workflow guide
- docs/README_Guide_App.md - Detailed app docs
- Check Troubleshooting section
- Review test cases for examples
- Read code comments in src/guide_app.py
- Open an issue
- Web UI implementation
- Database integration for caching
- Multi-language support
- Advanced filtering options
- User preferences/favorites
- Social sharing features
- Mobile app version
Made with β€οΈ for location explorers
Last Updated: 2026-05-30 | Version: 1.0.0