Skip to content

A full-featured AMap (Gaode Map) React Native component library built with Expo Modules, providing map display, location services, overlays, and more.

Notifications You must be signed in to change notification settings

TomWq/expo-gaode-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

323 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

expo-gaode-map

A fully-featured Amap (Gaode Map) React Native library, built with Expo Modules API, using Monorepo architecture. It provides complete functionality including map display, location, search, navigation, and Web API.

๐Ÿ’ก This library is built using Expo Modules API, providing type-safe native module interfaces and an excellent developer experience.

๐Ÿ“– Complete Documentation

๐Ÿ‘‰ Online Documentation ยท ๐Ÿ‘‰ Example Repository

Includes complete API documentation, usage guides, and example code:

โœจ Key Features

Core Features (expo-gaode-map)

  • โœ… Complete map functionality (multiple map types, gesture controls, camera operations, offline maps)
  • โœ… Precise location (continuous location, single location, coordinate conversion)
  • โœ… Rich overlays (Circle, Marker, Polyline, Polygon, HeatMap, Cluster, etc.)
  • โœ… Friendly error notification system (detailed solutions and documentation links)
  • โœ… Complete TypeScript type definitions
  • โœ… Cross-platform support (Android, iOS)
  • โœ… Supports both new and old React Native architectures (Paper & Fabric)
  • โœ… High test coverage (75.7%, 207 unit tests)
  • โœ… User-friendly error notification system
  • โœ… Custom Marker overlay support
  • โœ… Optimized map loading by default to reduce memory usage

Optional Modules

  • ๐Ÿ” Search Functionality (expo-gaode-map-search) - POI search, nearby search, keyword search, geocoding, etc.
  • ๐Ÿงญ Navigation Functionality (expo-gaode-map-navigation) - Driving, walking, cycling, truck route planning, real-time navigation
  • ๐ŸŒ Web API (expo-gaode-map-web-api) - Pure JavaScript implementation of route planning, geocoding, POI search, etc.

๐Ÿ“ฆ Installation

Option 1: Map and Location Only (Core Package)

npm install expo-gaode-map

# Optional modules
npm install expo-gaode-map-search      # Search functionality
npm install expo-gaode-map-web-api     # Web API

Option 2: Navigation Functionality (Navigation Package, Includes Map)

npm install expo-gaode-map-navigation  # Includes map + navigation

# Optional modules
npm install expo-gaode-map-web-api     # Web API

โš ๏ธ Important: expo-gaode-map and expo-gaode-map-navigation cannot be installed simultaneously due to SDK conflicts. Choose one.

Config Plugin Configuration (Recommended)

Configure in app.json to automatically set up native API keys and permissions:

{
  "expo": {
    "plugins": [
      [
        "expo-gaode-map",  // or "expo-gaode-map-navigation"
        {
          "androidKey": "your-android-key",
          "iosKey": "your-ios-key"
        }
      ]
    ]
  }
}

After configuration, rebuild:

npx expo prebuild --clean
npx expo run:android
npx expo run:ios

๐Ÿš€ Quick Start

For detailed initialization and usage guides, please see:

๐Ÿ“š Feature Module Comparison

Feature Core Package Search Package Navigation Package Web API
Map Display โœ… โŒ โœ… โŒ
Location โœ… โŒ โœ… โŒ
Overlays โœ… โŒ โœ… โŒ
POI Search โŒ โœ… โŒ โœ…
Geocoding โŒ โœ… โŒ โœ…
Route Planning โŒ โŒ โœ… โœ…
Real-time Navigation โŒ โŒ โœ… โŒ
Platform Native Native Native Web/Native

๐Ÿ—๏ธ Monorepo Architecture

expo-gaode-map/
โ”œโ”€โ”€ packages/
โ”‚   โ”œโ”€โ”€ core/                    # expo-gaode-map (Core package)
โ”‚   โ”‚   โ””โ”€โ”€ Map display, location, overlays
โ”‚   โ”œโ”€โ”€ search/                  # expo-gaode-map-search (Search package)
โ”‚   โ”‚   โ””โ”€โ”€ POI search, geocoding
โ”‚   โ”œโ”€โ”€ navigation/              # expo-gaode-map-navigation (Navigation package)
โ”‚   โ”‚   โ””โ”€โ”€ Map + navigation (replaces core)
โ”‚   โ””โ”€โ”€ web-api/                 # expo-gaode-map-web-api (Web API)
โ”‚       โ””โ”€โ”€ Pure JS route planning, etc.
โ””โ”€โ”€ Note: core and navigation cannot be installed together

๐Ÿ’ก FAQ

1. How to choose between Core and Navigation packages?

  • Only need map and location โ†’ Install expo-gaode-map
  • Need navigation functionality โ†’ Install expo-gaode-map-navigation (includes map functionality)
  • Cannot install both: Due to native SDK conflicts, you can only choose one

2. What's the difference between Search and Web API?

  • Search package (expo-gaode-map-search): Native implementation, better performance, requires native environment configuration
  • Web API (expo-gaode-map-web-api): Pure JavaScript, no native configuration needed, better cross-platform compatibility

3. How to configure API keys?

It's recommended to use Config Plugin for automatic configuration. See: Initialization Guide

4. How to handle errors? ๐Ÿ†•

expo-gaode-map provides a comprehensive error handling system:

import ExpoGaodeMapModule, { GaodeMapError, ErrorType } from 'expo-gaode-map';

try {
  await ExpoGaodeMapModule.getCurrentLocation();
} catch (error) {
  if (error instanceof GaodeMapError) {
    console.error(error.message);  // Friendly error message
    console.log(error.solution);   // Detailed solution
    console.log(error.docUrl);     // Related documentation link
  }
}

Complete Error Handling Guide: ERROR_HANDLING_GUIDE.md

Supported error types:

  • SDK_NOT_INITIALIZED - SDK not initialized
  • INVALID_API_KEY - API key configuration error
  • PERMISSION_DENIED - Permission not granted
  • LOCATION_FAILED - Location failed
  • MAP_VIEW_NOT_INITIALIZED - Map view not initialized
  • More error types...

๐Ÿค Contributing

Issues and Pull Requests are welcome!

๐Ÿ“„ License

MIT

๐Ÿ“š Documentation & Resources

๐Ÿ™ Acknowledgments

This project referenced the following excellent projects during development:

Thank you to all contributors of these open-source projects!

๐Ÿ“ฎ Feedback & Support

If you encounter any issues or have any suggestions during usage, please feel free to:

  • ๐Ÿ“ Submit a GitHub Issue
  • ๐Ÿ’ฌ Join Discussions
  • โญ Give the project a Star to show your support
  • ็พค๏ผš952241387 ๏ผˆๆฌข่ฟŽๅŠ ๅ…ฅ๏ผŒไบคๆตไฝฟ็”จ็ป้ชŒใ€้—ฎ้ข˜ๅ้ฆˆ็ญ‰๏ผ‰

About

A full-featured AMap (Gaode Map) React Native component library built with Expo Modules, providing map display, location services, overlays, and more.

Resources

Stars

Watchers

Forks

Packages

No packages published