Why Basemaps Matter
The basemap provides vital geographic context for overlay data like enforcement zones and detention centers. Proprietary basemap providers introduce unacceptable risks:
| Risk | Impact |
|---|---|
| Unexpected costs | API pricing changes |
| Rate limiting | Traffic spikes blocked |
| User tracking | Location data harvested |
| Reliability | Downtime during critical events |
Open-source and self-hosted tile services eliminate these risks.
Free Public Tile Services
OpenStreetMap-Based Services
| Service | URL Pattern | Use Case |
|---|---|---|
| OSM Standard | {s}.tile.openstreetmap.org/{z}/{x}/{y}.png |
General purpose |
| Humanitarian | tile-{s}.openstreetmap.fr/hot/{z}/{x}/{y}.png |
Crisis response |
| Carto Light | {s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png |
Minimal, clean |
| Carto Dark | {s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png |
Dark mode |
Usage Requirements
Mandatory Attribution:
© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors
Usage Limits
| Service | Limit | Notes |
|---|---|---|
| OSM | Fair use | No bulk downloading |
| Carto | 75,000/month free | Requires signup for more |
| Stamen | Fair use | Migrated to Stadia Maps |
Self-Hosting for Resilience
Why Self-Host?
- No rate limits - Handle traffic spikes during raids
- Privacy - No third-party IP logging
- Reliability - Control your uptime
- Customization - Full style control
Software Stack
| Component | Software | Purpose |
|---|---|---|
| Tile Server | TileServer GL | Serve vector/raster tiles |
| Data Source | OpenMapTiles | Pre-processed OSM data |
| Styling | Maputnik | Visual style editor |
Hardware Requirements
| Scope | CPU | RAM | Storage |
|---|---|---|---|
| Regional (single state) | 2 cores | 2GB | 10GB SSD |
| National (USA) | 4 cores | 8GB | 50GB SSD |
| Global (dynamic rendering) | 4+ cores | 16GB+ | 100GB+ SSD |
Docker Deployment
# docker-compose.yml
version: '3'
services:
tileserver:
image: maptiler/tileserver-gl
ports:
- "8080:8080"
volumes:
- ./data:/data
command: --config /data/config.json
TileServer GL Configuration
{
"options": {
"paths": {
"root": "/data"
}
},
"styles": {
"advocacy-light": {
"style": "styles/advocacy-light.json"
}
},
"data": {
"openmaptiles": {
"mbtiles": "usa.mbtiles"
}
}
}
Custom Map Styling
Why Custom Styles?
Commercial basemaps contain visual noise that distracts from advocacy content:
- Retail points of interest
- Dense transit networks
- Vibrant terrain shading
Custom styles emphasize relevant features:
- Jurisdictional boundaries
- Highways and migration routes
- Enforcement infrastructure
Maputnik Editor
Maputnik is a free, browser-based visual editor for MapLibre Style Specification.
Access: https://maputnik.github.io/
Style Customization Workflow
- Load template style (OSM Liberty, Positron)
- Remove unnecessary layers (POIs, transit)
- Emphasize boundaries (counties, states)
- Adjust colors for high contrast
- Export style.json
Advocacy-Optimized Style
{
"version": 8,
"name": "Advocacy Light",
"sources": {
"openmaptiles": {
"type": "vector",
"url": "https://tiles.yourserver.org/data/openmaptiles.json"
}
},
"layers": [
{
"id": "background",
"type": "background",
"paint": { "background-color": "#f8f8f8" }
},
{
"id": "boundary-state",
"type": "line",
"source": "openmaptiles",
"source-layer": "boundary",
"filter": ["==", "admin_level", 4],
"paint": {
"line-color": "#666666",
"line-width": 1.5,
"line-dasharray": [3, 2]
}
},
{
"id": "boundary-county",
"type": "line",
"source": "openmaptiles",
"source-layer": "boundary",
"filter": ["==", "admin_level", 6],
"paint": {
"line-color": "#999999",
"line-width": 0.5
}
}
]
}
Color Accessibility
| Purpose | Recommended | Avoid |
|---|---|---|
| Basemap | Muted grays (#f8f8f8) | Vibrant colors |
| Boundaries | Dark gray (#666) | Light gray |
| Overlay data | High contrast (red, blue) | Similar to basemap |
| Text | 4.5:1 contrast ratio | Low contrast |
Offline Tile Caching
Browser-Based Caching (MapLibre)
// Using maplibre-gl-offline-ts plugin
import { OfflineControl } from 'maplibre-gl-offline-ts';
map.addControl(new OfflineControl({
database: 'advocacy-tiles-db',
storageType: 'indexeddb'
}));
Mobile Offline Packages
MBTiles Format
Pre-rendered tiles stored in SQLite database:
# Generate MBTiles for California
tilemaker --input california.osm.pbf \
--output california.mbtiles \
--config config.json
Distributing Offline Maps
| Method | Use Case |
|---|---|
| QR code | Link to download page |
| Direct download | Flyers with URL |
| USB distribution | Community events |
Mobile Apps Supporting Offline
| App | Platform | Custom POI Support |
|---|---|---|
| OsmAnd | Android/iOS | ✅ GPX import |
| Maps.me | Android/iOS | ✅ Bookmarks |
| Organic Maps | Android/iOS | ✅ KML import |
OsmAnd Custom POI Import
<!-- checkpoints.gpx -->
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="advocacy-tools">
<wpt lat="32.5" lon="-117.1">
<name>San Ysidro Checkpoint</name>
<desc>Permanent Border Patrol checkpoint</desc>
<extensions>
<osmand:icon>checkpoint_red</osmand:icon>
<osmand:background>circle</osmand:background>
</extensions>
</wpt>
</gpx>
Tile Formats
Raster vs Vector
| Aspect | Raster Tiles | Vector Tiles |
|---|---|---|
| Format | PNG/JPG images | PBF binary |
| Styling | Fixed at generation | Dynamic client-side |
| File size | Larger | Smaller |
| Server load | Higher (rendering) | Lower (static files) |
| Use case | Simple maps | Dynamic filtering |
Vector Tile Advantages
- Client-side styling - Change colors without regenerating
- Dynamic filtering - Toggle layers instantly
- Smaller bandwidth - Compressed geometry data
- Crisp at all zooms - No pixelation
Performance Optimization
CDN Configuration
# nginx.conf for tile caching
location /tiles/ {
proxy_pass http://tileserver:8080/;
proxy_cache tiles_cache;
proxy_cache_valid 200 7d;
proxy_cache_key "$request_uri";
add_header X-Cache-Status $upstream_cache_status;
}
Tile Loading Strategies
| Strategy | Description |
|---|---|
| Viewport-first | Load visible tiles first |
| Progressive | Low-res then high-res |
| Predictive | Pre-load adjacent tiles |
Monitoring
Track tile server health:
- Response times
- Cache hit rates
- Error rates during high traffic
Related Guides
- Libraries Comparison - Choosing rendering library
- Privacy Features - Protecting user data
- Print & Offline - Field deployment
- Implementation - Full deployment guide