This example demonstrates how to use the MapConductor React SDK with both MapLibre and Google Maps providers.
-
Install dependencies:
npm install
-
Configure environment variables:
Copy the example environment file:
cp .env.example .env.local
Then edit
.env.localand add your Google Maps API key:VITE_GOOGLE_MAPS_API_KEY=your_actual_api_key_hereGet a Google Maps API key from: https://console.cloud.google.com/
npm run devThe app will be available at http://localhost:4000.
npm run buildnpm run previewThis project uses Vite's environment variable system. All environment variables must be prefixed with VITE_ to be exposed to the client code.
VITE_GOOGLE_MAPS_API_KEY- Your Google Maps API key (required for Google Maps provider)
- The
.env.localfile is ignored by git and should never be committed - Environment variables prefixed with
VITE_are embedded in the client bundle - Never put sensitive secrets that should remain server-side in
VITE_variables - For production deployment, set environment variables in your hosting platform
- Switch between MapLibre and Google Maps providers
- Interactive map with markers
- Camera controls (fly to locations)
- Demonstrates unified API across different map providers
- Open source, no API key required
- Uses OpenStreetMap Japan tiles by default
- Fast and lightweight
- Requires API key (set in
.env.local) - Official Google Maps experience
- Rich features and styling options