Maps & User Locations
Maps & User Locations
Display interactive maps on your website to show listing locations, help users find businesses, and enhance the user experience. Your PremiumPress theme supports both Google Maps and Mapbox.
Reading time: 10 minutes
Overview
Maps are essential for directory, real estate, classifieds, and location-based websites. They help users:
- Visualize where listings are located
- Search for items near their location
- Get directions to businesses or properties
- Browse listings by geographic area
- Filter results based on distance
Map Features in PremiumPress
- Interactive pins: Click markers to see listing details
- Auto-geocoding: Convert addresses to coordinates automatically
- Radius search: Find listings within X miles/kilometers
- Clustering: Group nearby markers for better performance
- Custom markers: Use custom icons for different categories
- User location: Detect visitor's current location
- Street view: Integrate Google Street View (Google Maps only)
Choosing a Map Provider
Your PremiumPress theme supports two map providers. Here's how to choose:
Google Maps
Best for: Most websites, especially if you need Street View
Pros:
- Most accurate and up-to-date map data worldwide
- Familiar interface that users recognize
- Includes Street View and satellite imagery
- Excellent geocoding accuracy
- Works well in all countries
- Better business/POI data
Cons:
- Requires API key setup
- Free tier includes 28,000 map loads/month
- Costs money after free quota (though most sites stay free)
- Requires credit card on file
Cost: Free for most small to medium websites ($200/month free credit)
Mapbox
Best for: High-traffic sites or those wanting custom map styles
Pros:
- More generous free tier (50,000 loads/month)
- Highly customizable map styles
- Modern, beautiful default design
- No credit card required for free tier
- Better pricing for high-volume sites
- Excellent performance
Cons:
- Less familiar to users than Google Maps
- No Street View integration
- Geocoding may be less accurate in some regions
- Fewer POI/business data
Cost: Free for up to 50,000 loads/month
Our Recommendation
Use Google Maps if:
- You're starting a new site (free tier is generous)
- You need Street View
- You want the most accurate location data
- Your users expect Google Maps
Use Mapbox if:
- You expect high traffic (50,000+ monthly loads)
- You want custom map styling
- You don't want to provide credit card info
- You prefer a modern, minimalist map design
Setting Up Google Maps
Follow these steps to enable Google Maps on your website.
Step 1: Create a Google Cloud Account
- Go to https://console.cloud.google.com/
- Sign in with your Google account (or create one)
- Accept the terms of service
- You'll need to add a credit card (required but won't be charged within free tier)
Step 2: Create a New Project
- Click the project dropdown at the top of the page
- Click "New Project"
- Enter a project name (e.g., "My Website Maps")
- Click "Create"
- Wait for the project to be created (takes a few seconds)
- Select your new project from the dropdown
Step 3: Enable Required APIs
- Go to "APIs & Services" > "Library"
- Search for and enable these APIs:
- Maps JavaScript API (required)
- Geocoding API (required)
- Places API (recommended)
- Geolocation API (optional, for user location detection)
- Click each API and press the "Enable" button
Step 4: Create API Key
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "API Key"
- Your API key will be generated
- Click "Copy" to copy the key
- Important: Don't close this window yet
Step 5: Restrict Your API Key (Important for Security)
- Click "Restrict Key" in the popup
- Under "Application restrictions":
- Select "HTTP referrers (websites)"
- Under "Website restrictions", click "Add an item"
- Add your domain:
yourdomain.com/* *.yourdomain.com/* - Under "API restrictions":
- Select "Restrict key"
- Check: Maps JavaScript API, Geocoding API, Places API
- Click "Save"
Step 6: Add API Key to PremiumPress
- Log into your WordPress admin
- Go to PremiumPress > Settings > Maps
- Select "Google Maps" as your map provider
- Paste your API key in the "Google Maps API Key" field
- Click "Save Settings"
- Test the map on your site to confirm it's working
Monitoring Your Usage
- Go to Google Cloud Console
- Click "APIs & Services" > "Dashboard"
- View your daily/monthly API requests
- You get $200 free credit per month (roughly 28,000 map loads)
- Set up billing alerts to avoid unexpected charges
Video Tutorial: Watch how to setup Google Maps
Setting Up Mapbox
Mapbox is a great alternative to Google Maps with a more generous free tier.
Step 1: Create a Mapbox Account
- Go to https://www.mapbox.com/
- Click "Sign Up"
- Enter your email and create a password
- Verify your email address
- No credit card required for free tier
Step 2: Get Your Access Token
- After logging in, you'll see your account dashboard
- Your default access token is displayed on the main page
- Copy the "Default public token"
- Keep this page open
Step 3: Create a Custom Token (Recommended)
For better security, create a token specifically for your website:
- Go to Account > Access Tokens
- Click "Create a token"
- Give it a name (e.g., "My Website")
- Under "Token restrictions", add your website URL
- Select these scopes:
- styles:tiles (required)
- styles:read (required)
- fonts:read (recommended)
- datasets:read (optional)
- Click "Create token"
- Copy your new token
Step 4: Add Token to PremiumPress
- Log into your WordPress admin
- Go to PremiumPress > Settings > Maps
- Select "Mapbox" as your map provider
- Paste your access token in the "Mapbox Access Token" field
- Click "Save Settings"
- Test the map on your site
Step 5: Choose a Map Style (Optional)
Mapbox offers several pre-built styles:
- Streets: Default street map (recommended)
- Outdoors: Emphasizes topography and outdoor features
- Light: Minimal, clean design
- Dark: Dark theme, great for modern websites
- Satellite: Satellite imagery
- Satellite Streets: Satellite with street labels
- In PremiumPress settings, find "Map Style"
- Select your preferred style
- Or enter a custom style URL from Mapbox Studio
- Save settings
Monitoring Your Usage
- Go to Mapbox Account
- Click "Statistics"
- View your monthly map loads
- Free tier: 50,000 loads/month
- After that: $5 per 1,000 additional loads
Configuring Map Settings
Once you've set up your map provider, customize how maps appear on your site.
Basic Map Settings
Go to PremiumPress > Settings > Maps
Default Map Center
- Latitude: Default center point latitude
- Longitude: Default center point longitude
- Zoom Level: Default zoom (1-20, where 20 is closest)
- Example: New York City: 40.7128, -74.0060, Zoom: 12
Map Type
- Roadmap: Standard street map (default)
- Satellite: Satellite imagery only
- Hybrid: Satellite with street labels
- Terrain: Shows elevation and terrain features
Map Controls
Enable/disable these controls:
- Zoom controls: +/- buttons to zoom in/out
- Street View: Pegman icon for Street View (Google Maps only)
- Map type selector: Switch between map/satellite/terrain
- Fullscreen: Button to view map in fullscreen
- Scale: Distance scale at bottom of map
Marker Settings
Marker Clustering
When enabled, nearby markers are grouped together for better performance:
- Enable clustering: Yes/No
- Cluster radius: Distance before markers merge (50-200 pixels)
- Max zoom: Maximum zoom level where clustering occurs
Recommendation: Enable clustering if you have 50+ listings
- [LINK id="rRZ42h1O-3Q"]How do I setup Google maps?[/LINK]
- [LINK id="Yyrgnrrefr8"]How do I setup Map box?[/LINK]
- [LINK id="Yotf25w_JyA"]Maps and user locations[/LINK]