All guides

GPS Coordinates, DMS Formats, Haversine Distance, and Timezone Logistics Engineering

Prevent mapping and scheduling bugs: DMS to signed decimal coordinates, GeoJSON lon-lat order traps, Haversine vs driving miles, and SLA business days.

Handling geographic coordinates, shipping distances, and cross-border service-level agreements (SLAs) reliably breaks applications in surprisingly stubborn ways: an importer forgets the negative sign converting 74°W longitude and drops New York stores into rural Kazakhstan; a developer passes [latitude, longitude] into a GeoJSON validator expecting [longitude, latitude]; or an invoicing job calculates "5 business days" linearly over a long holiday weekend.

Understanding coordinate notations, distance geometry, and calendar arithmetic eliminates spatial and scheduling surprises cleanly.

DMS vs. Signed Decimal Degrees (and the Hemisphere Sign Bug)

Location systems pass coordinates in two primary representations:

  1. Degrees, Minutes, Seconds (DMS): Human survey and aviation notation (37° 46' 29.6" N, 122° 25' 09.8" W). Convert accurately with Decimal = Degrees + (Minutes / 60) + (Seconds / 3600) using a DMS to Decimal Degrees, Decimal Degrees to DMS, GPS Coordinate Converter, or Coordinate Converter.
  2. Signed Decimal Degrees (DD): Standard database, Google Maps, and API format (37.7749, -122.4194).

Watch the Two Classic Geospatial Bugs in Codebases

  • Dropping negative signs on Western or Southern hemispheres: North and East are positive (+); West and South must be negative (-)! Parsing DMS numbers without checking the trailing W or S letter silently flips locations cleanly across the equator or prime meridian into the opposite side of Earth.
  • The [lat, lon] vs. GeoJSON [lon, lat] swap (RFC 7946): Google Maps UI, Leaflet, and Apple CoreLocation write (latitude, longitude)—yet GeoJSON, PostGIS ST_Point(x, y), and Mapbox GL use mathematical [longitude, latitude] (X, Y) order! Always assert latitude bounds ([-90, +90]) separately from longitude bounds ([-180, +180]) at ingestion; coordinates like [122.4, 37.7] fail latitude bounds immediately (122.4 > 90), catching axis swaps automatically before corrupted pins hit storage!
  • Meaningful coordinate precision: 5 decimal places (~1.1 meter accuracy at the equator) covers building storefronts and delivery dropoffs cleanly—storing 14 decimal places wastes storage claiming sub-atomic precision GPS chips never measure.

Great-Circle (Haversine) Distance vs. Real Route Travel

Database proximity queries (stores within 25 km) compute spherical great-circle (Haversine) straight-line mileage across the globe cleanly via a Distance Calculator or Map Scale Calculator.

However, do not promise straight-line radius numbers as courier ETA or truck drive times: rivers, mountain ranges, highway loops, and congested city bridges routinely make actual driving routes 1.25x to 1.6x longer than straight-line Haversine distance (circuity factor)! Use Haversine strictly as a fast bounding filter, then estimate realistic route durations cleanly with a Travel Time Calculator or Flight Time Calculator alongside jet-lag recovery timing via a Jet Lag Calculator. (Note: unlike physical GPS tags, public GeoIP estimators covered in our IP and ASN lookup guide only map rough ISP city routing points—never exact user addresses.)

Global Team Coordination and SLA Business-Day Math

Building contract renewal reminders, shipping cutoffs, or remote support windows across continents breaks whenever "add 5 days" treats weekends and regional timezones identically (see also our distributed systems timestamp guide):

Worked Coordinate Conversion Example (DMS -> Signed Decimal & GeoJSON)

Imagine receiving survey coordinates for a customer warehouse in San Francisco: 37° 46' 29.6" N, 122° 25' 09.8" W:

  1. Compute positive latitude (North): 37 + (46 / 60) + (29.6 / 3600) = +37.774889 (~37.77489).
  2. Compute negative longitude (West requires - negation!): -(122 + (25 / 60) + (9.8 / 3600)) = -122.419389 (~-122.41939).
  3. Order deliberately by target consumer:
    • Google Maps / SQL lat, lon pair: (37.77489, -122.41939)
    • GeoJSON / PostGIS [lon, lat] array: [-122.41939, 37.77489]

Catching whether an incoming feed swapped axes (-122.4 sits safely outside latitude's [-90, 90] limit, though European latitudes and East Asian longitudes like [48.8, 2.3] sit inside both valid ranges!) requires strict schema naming (lat / lng keys instead of unlabelled positional arrays wherever possible).


Bottom line: Enforce strict S/W sign negation and [-90, 90] vs. [-180, 180] GeoJSON axis assertions everywhere, treat Haversine geometry as a search filter rather than true driving mileage, and compute cross-border SLAs cleanly in explicit business days and matching regional business hours.

Put this guide to work

Try the tools mentioned here: all free tools or browse by category.