Google Maps Setup
Multiforum supports Google Maps integration for event locations. Users can search for venues, display event locations on maps, and discover nearby events.
Features
With Google Maps enabled:
- Location Search - Search for venues when creating events
- Place Autocomplete - Get address suggestions as you type
- Map Display - Show event locations on interactive maps
- Marker Clustering - Group nearby events on map views
- Directions - Link to Google Maps for navigation
Setting Up Google Maps
1. Create a Google Cloud Project
- Go to Google Cloud Console
- Create a new project or use an existing one
2. Enable Required APIs
Enable the following APIs in your project:
- Go to APIs & Services → Library
- Search for and enable:
- Maps JavaScript API - For displaying maps
- Places API - For location search and autocomplete
- Geocoding API - For converting addresses to coordinates
3. Create an API Key
- Go to APIs & Services → Credentials
- Click Create Credentials → API Key
- Note your API key
4. Restrict Your API Key (Recommended)
For security, restrict your API key:
Application Restrictions:
- Select HTTP referrers (web sites)
- Add your frontend domain:
https://your-domain.com/*
API Restrictions:
- Select Restrict key
- Choose: Maps JavaScript API, Places API, Geocoding API
5. Create a Map ID (Optional)
For custom map styling:
- Go to Google Maps Platform → Map Styles
- Click Create Style
- Customize your map appearance
- Create a Map ID and note it
Environment Variables
Add these to your frontend configuration:
VITE_GOOGLE_MAPS_API_KEY=your-api-key
VITE_GOOGLE_MAP_ID=your-map-id # Optional, for custom styling
Optional: OpenCage Geocoding
For additional geocoding capabilities (reverse geocoding, address parsing), you can add OpenCage:
- Create an account at OpenCage
- Get your API key
- Add to environment:
VITE_OPEN_CAGE_API_KEY=your-opencage-key
Event Location Features
Creating Events with Locations
When Google Maps is configured, users can:
- Search for a venue - Type a venue name or address
- Select from suggestions - Google Places provides autocomplete
- Add virtual event URLs - For online events
- Mark private residences - Hide exact address for privacy
Event Data Model
Events store location information:
| Field | Description |
|---|---|
locationName | Venue name (e.g., "Coffee Shop") |
address | Full street address |
placeId | Google Places ID for the venue |
location | Geographic coordinates (Point type) |
virtualEventUrl | URL for online events |
isInPrivateResidence | Flag to hide exact address |
Recurring Events
Event series can share location information:
- Set location once on the series
- All occurrences inherit the location
- Individual events can override the series location
Map Display Features
Event List Maps
When viewing events in a channel or search results:
- Map shows all event locations as markers
- Clicking a marker shows event preview
- Marker clustering groups nearby events
Single Event Maps
When viewing a single event:
- Map centers on the event location
- Address is displayed
- Link to open in Google Maps for directions
Map Clustering
For pages with many events, markers are automatically clustered:
- Clusters show event count
- Clicking a cluster zooms in
- Individual markers appear at higher zoom levels
Privacy Considerations
Private Residence Events
For events at private homes:
- Host marks event as "private residence"
- Exact address is hidden from non-attendees
- General area may still be shown on map
- Full address shared only with confirmed attendees
Location Accuracy
- Google Places provides standardized addresses
- Coordinates are stored for map display
- Users can optionally hide their location
Troubleshooting
Maps Not Loading
- Verify API key is correct
- Check API key restrictions allow your domain
- Ensure Maps JavaScript API is enabled
- Check browser console for error messages
Places Autocomplete Not Working
- Verify Places API is enabled
- Check API key has access to Places API
- Ensure you're using HTTPS (required by Google)
Geocoding Failures
- Verify Geocoding API is enabled
- Check you haven't exceeded API quotas
- Some addresses may not geocode accurately
API Quota Issues
Google Maps has usage quotas:
- Monitor usage in Cloud Console
- Set budget alerts
- Consider enabling billing for higher limits
Cost Considerations
Google Maps APIs have usage-based pricing:
| API | Free Tier | After Free Tier |
|---|---|---|
| Maps JavaScript | 28,000 loads/month | $7 per 1,000 |
| Places | 10,000 requests/month | $17 per 1,000 |
| Geocoding | 40,000 requests/month | $5 per 1,000 |
Most small to medium Multiforum instances will stay within free tier limits.