# african-countries
Enhanced GeoJSON data and utilities for African countries with TypeScript support.
## Features
- **Rich Metadata**: Each country includes ISO codes, region, capital, **currency**, **dialing codes**, **trade blocs**, and **neighboring countries**.
- **Spatial Analysis**: Built-in geofencing to check if coordinates are within a specific country.
- **Centroids & Bounding Boxes**: `centroid` and `bbox` coordinates for map markers and zooming.
- **Flags & i18n**: Flag emojis and country names translated into FR, AR, PT, and SW.
- **Advanced Map Rendering**: Built-in SVG generators for the **continent** or **individual countries** with Albers projection support.
- **CLI Tool**: Powerful terminal interface including a **Geography Quiz** and **Country Renderer**.
- **React Support**: Built-in `useAfricaMap` hook for modern web applications.
- **Thematic Palettes**: Beautiful color presets like `Serengeti`, `Sahara`, and `Rainforest`.
## Installation
```bash
npm install african-countries
```
## CLI Usage
```bash
# List all countries
npx african-countries list
# Find which country a coordinate belongs to
npx african-countries within 6.52 3.37
# Returns: 🇳🇬 Nigeria
# List ECOWAS member states
npx african-countries bloc ECOWAS
# Search for countries
npx african-countries search Nig
# Preview map in terminal
npx african-countries render
# Play the geography quiz
npx african-countries quiz
# Render a specific country SVG
npx african-countries render-country Nigeria > nigeria.svg
# Export SVG map
npx african-countries export-svg > africa.svg
```
## Usage
### React Hook Example
```tsx
import { useAfricaMap } from 'african-countries';
function MapComponent() {
const { svgString, hoveredCountry } = useAfricaMap({
dimensions: { width: 600, height: 600 }
});
return ;
}
```
### Neighbors & Relationships
For more detailed examples, check the examples/ folder in the repository.
### Spatial Analysis (Geofencing)
```typescript
import { isLocationI …