Map overview
The interactive map is the visual centerpiece of Daily GeoGame, providing real-time feedback on your guesses through color-coded country highlighting. Built on SVG technology, the map supports smooth zooming and panning to help you explore every corner of the world.Key capabilities
- Color-coded feedback: Each guess changes the map to show how close you are
- Zoom and pan controls: Navigate freely to examine specific regions
- Neighbor visualization: See which countries border your guessed nations
- Country tooltips: Hover over highlighted countries to see their names
- Responsive design: Works seamlessly on desktop, tablet, and mobile devices
The map uses an SVG (Scalable Vector Graphics) format, which means it remains sharp and clear at any zoom level—no pixelation or blurriness.
Color-coding system
The map uses a five-color system to provide instant visual feedback on how close your guess is to the target country:Target (Green)
Color: Dark green
Meaning: This is the correct answer
When shown: After you guess correctly or the game ends
Meaning: This is the correct answer
When shown: After you guess correctly or the game ends
Neighbor (Yellow)
Color: Bright yellow
Meaning: Shares a land border with the target
When shown: When your guess directly borders the target country
Meaning: Shares a land border with the target
When shown: When your guess directly borders the target country
Same Subregion (Orange)
Color: Orange
Meaning: In the same subregion (e.g., “Central Europe”)
When shown: When your guess is in the target’s subregion but not a neighbor
Meaning: In the same subregion (e.g., “Central Europe”)
When shown: When your guess is in the target’s subregion but not a neighbor
Same Region (Red-Orange)
Color: Red-orange
Meaning: In the same broad region (e.g., “Europe”)
When shown: When your guess is in the target’s region but different subregion
Meaning: In the same broad region (e.g., “Europe”)
When shown: When your guess is in the target’s region but different subregion
Incorrect (Dark Red)
Color: Dark red
Meaning: Not geographically related to the target
When shown: When your guess is in a completely different region
Meaning: Not geographically related to the target
When shown: When your guess is in a completely different region
Understanding geographic relationships
The color system is based on geographic proximity data from the RestCountries API:- Borders: Physical land boundaries between countries
- Subregion: Detailed geographic groupings (e.g., “Eastern Europe”, “Southeast Asia”)
- Region: Broad continental categories (e.g., “Europe”, “Asia”, “Africa”)
Complete list of regions and subregions
Complete list of regions and subregions
Africa: Northern Africa, Eastern Africa, Western Africa, Southern Africa, Middle AfricaAmericas: Caribbean, Central America, South America, North AmericaAsia: Central Asia, Eastern Asia, South-Eastern Asia, Southern Asia, Western AsiaEurope: Eastern Europe, Northern Europe, Southern Europe, Western EuropeOceania: Australia and New Zealand, Melanesia, Micronesia, PolynesiaAntarctica: (no subregions)
Island nations with no land borders can still be neighbors if they’re in the same subregion as the target. For example, Caribbean island nations are treated as neighbors to each other.
Zoom and pan controls
The map includes intuitive navigation controls built with thereact-zoom-pan-pinch library:
Button controls
Three buttons appear in the top-right corner of the map:+ (Plus)
Zooms in on the map, increasing the view scale by one step. Click repeatedly to zoom in further.
- (Minus)
Zooms out from the map, decreasing the view scale by one step. Click repeatedly to zoom out further.
Mouse and touch gestures
Mouse wheel zoom
Mouse wheel zoom
Scroll your mouse wheel up to zoom in or down to zoom out. The zoom centers on your cursor position.
Click and drag panning
Click and drag panning
Click and hold anywhere on the map, then drag to pan in any direction. Release to stop panning.
Double-click zoom
Double-click zoom
Double-click anywhere on the map to zoom in on that location.
Pinch zoom (touch devices)
Pinch zoom (touch devices)
On tablets and phones, use a two-finger pinch gesture to zoom in or out.
Touch drag (touch devices)
Touch drag (touch devices)
On touch screens, tap and drag with one finger to pan the map.
Zoom limits
The map enforces sensible zoom boundaries:- Minimum scale: 0.5x (zoomed out to half size)
- Maximum scale: 12x (zoomed in to 12 times size)
- Default scale: 1x (full world view, centered)
Country highlighting
As you make guesses, countries are highlighted on the map in real-time through SVG manipulation:How it works
The map component (/app/components/Map.tsx:51-103) uses a smart highlighting system:
- Each country is represented by an SVG
<path>element with an ID matching its two-letter country code (e.g.,FRfor France,JPfor Japan) - When you make a guess, the system finds the corresponding path element
- The
fillandstrokeattributes are updated to the appropriate color based on the country’s relationship to the target - A tooltip
<title>element is added showing the country name on hover
#555555). As you guess, the map builds up a colorful visual story of your attempts.
Country code matching
The system uses ISO 3166-1 alpha-2 country codes:- United States:
US - Germany:
DE - Japan:
JP - Brazil:
BR - Australia:
AU
Fun fact
The world map SVG contains over 195 country paths, each carefully crafted to accurate geographic shapes and positioned in the correct location.
Color legend
A legend appears in the bottom-left corner of the map, explaining the color-coding system:- Always visible and overlaid on the map
- Black semi-transparent background for readability
- Lists all five color categories with colored circles
- Cannot be interacted with (pointer-events disabled)
Visual feedback flow
Here’s what happens visually when you make a guess:API processes guess
The backend determines the relationship between your guess and the target (neighbor, same region, etc.).
Map updates
The guessed country lights up in the appropriate color on the map, providing instant visual feedback.
Pattern emerges
As you make more guesses, the map shows a colorful pattern. Yellow neighbors reveal the target’s location, orange and red-orange guesses narrow the region.
The map persists all your guesses for the current challenge. If you refresh the page, your previous guesses remain highlighted because they’re saved in your session progress.
Technical implementation
The map leverages several modern web technologies: SVG rendering:react-svg library loads and injects the world map SVGTransform controls:
react-zoom-pan-pinch provides zoom/pan functionalityClient-side: Built as a React client component with useState and useEffect hooks
Dynamic styling: SVG attributes are manipulated via DOM queries
Performance optimizations
- The SVG is loaded once and cached by the browser
- Country highlighting uses efficient DOM attribute updates, not re-renders
- Transform operations are GPU-accelerated for smooth zooming and panning
- The map component only re-renders when the guesses array changes
Using the map strategically
Maximize the map’s value with these tips:- Zoom in on yellow neighbors: When a guess turns yellow, zoom in on that area to identify surrounding countries
- Look for patterns: Multiple orange guesses in one subregion indicate the target is likely nearby
- Use with hints: Cross-reference map patterns with hint information for more accurate guesses
- Reset often: Use the Reset button to get back to the full world view when you’re reorienting your strategy