Methodology
This page explains the algorithms, data sources, and technical decisions behind every SimpleMapLab tool. If you're evaluating our results for accuracy or building on our approach, this is your reference.
Distance calculation
The Distance Between Two Places tool and all radius-based tools use the Haversine formula — the standard great-circle distance formula on a sphere. It computes the shortest path between two points over the curved surface of the Earth.
The formula assumes a spherical Earth with radius R = 6,371 km (the mean volumetric radius). For distances under 1,000 km, the error vs. the WGS84 ellipsoid is under 0.3%. For longer distances, we use the same formula — the error never exceeds 0.5%.
Radius circles
The Map Radius Tool draws geodesic circles using Turf.js. Each circle is a 64-vertex polygon computed by projecting points at equal angular intervals from the center using the Haversine forward formula. This produces a true circle on the Earth's surface — unlike a naïve pixel-space circle on a Mercator map, which would be distorted at high latitudes.
Area measurement
The Map Area Calculator computes polygon area using Turf.js's geodesic area function, which integrates over the WGS84 ellipsoid. For radius circles, area is also computed as A = πr² on the sphere for cross-validation.
The Population Within Radius tool uses a simpler approach: the shoelace formula with a cos(lat) correction. This is accurate to within 1% for areas under 100,000 sq mi at mid-latitudes.
Drive time isochrones
The Drive Time Map calls the Valhalla routing engine, hosted publicly by FOSSGIS e.V.
How it works
- Valhalla loads the full OpenStreetMap road graph.
- From the origin point, it performs a Dijkstra-like expansion along connected road segments.
- Each segment has a cost (seconds) based on road functional class, speed limit, and length.
- Turns add a penalty: left turns across traffic cost more than right turns.
- When cumulative cost exceeds the threshold (e.g., 30 min), expansion stops on that branch.
- All reachable endpoints are connected into a polygon and smoothed (denoise + generalize).
Speed assumptions
| Road type | Drive | Bike | Walk |
|---|---|---|---|
| Interstate / motorway | 55–70 mph | Excluded | Excluded |
| Highway / trunk | 45–65 mph | 15–20 mph | Excluded |
| Arterial / primary | 30–45 mph | 12–16 mph | 3 mph |
| Residential | 20–30 mph | 10–14 mph | 3 mph |
| Service / alley | 10–15 mph | 8–10 mph | 3 mph |
| Path / sidewalk | Excluded | 8–12 mph | 3 mph |
Real-time traffic is not modeled. Results represent free-flow conditions.
Location detection (county/state/ZIP)
The What County Am I In?, What State Am I In?, and What ZIP Code Am I In? tools use a ray-casting point-in-polygon algorithm. Boundary data from the Census Bureau TIGER/Line files is loaded as TopoJSON and converted to GeoJSON features in the browser.
The ray-casting algorithm casts a horizontal ray from the test point and counts polygon edge crossings. An odd number of crossings means the point is inside. This runs in microseconds on modern devices.
Geocoding
- Forward (address → coordinates): Photon — typo-tolerant autocomplete built on OpenStreetMap data.
- Reverse (coordinates → address): Nominatim — structured address data including city, county, state, country, and postal code.
Elevation
The Elevation Finder calls the Open-Meteo Elevation API, which returns altitude from the Copernicus 30-meter Digital Elevation Model (DEM).
Atmospheric pressure is calculated using the International Standard Atmosphere (ISA) barometric formula: P = P₀ × (1 − Lh/T₀)^(gM/RL), where L = 0.0065 K/m (lapse rate), T₀ = 288.15 K, g = 9.80665 m/s², M = 0.0289644 kg/mol, R = 8.31447 J/(mol·K).
Time zones
The Time Zone Finder uses the geo-tz library with boundary data from timezone-boundary-builder. DST detection compares January and July UTC offsets using the JavaScript Intl.DateTimeFormat API.
Blank map generation
Maps are generated from TopoJSON using d3-geo projections:
- US states: geoMercator per state, geoAlbersUsa for the national map (with AK/HI insets)
- Countries: geoMercator with auto-cropped viewBox to fit content tightly
- Continents: geoMercator (or geoEqualEarth for the world map) with fixed bounding boxes for Europe, Oceania, and North America
PNG and PDF exports are generated client-side: PNG via HTML Canvas at 2400px, PDF via jsPDF. Nothing is uploaded to a server.
Data sources summary
| Data | Source | License |
|---|---|---|
| Map tiles | OpenFreeMap (OpenStreetMap) | ODbL |
| Road network | OpenStreetMap | ODbL |
| US boundaries | Census Bureau TIGER/Line via us-atlas | Public domain |
| World boundaries | Natural Earth 1:50m | Public domain |
| ZIP/city/county demographics | Census ACS via SimpleMaps | Public domain / MIT |
| Elevation | Copernicus 30m DEM via Open-Meteo | CC-BY-4.0 |
| Time zones | IANA tz database via timezone-boundary-builder | ODbL |
| Routing | Valhalla + OSM via FOSSGIS | MIT / ODbL |
Questions?
If you have questions about our methodology or believe a calculation is incorrect, please contact us with details.