How Do You Represent Coordinates Without Confusing Latitude and Longitude?
From the earlier reference collection. Read the current software blog.
Name coordinate axes explicitly and document their order, units, and reference system so clients place points correctly.
Order is a common source of error
A coordinate pair such as [-122.3, 47.6] is ambiguous without a stated order. One consumer may assume longitude comes first, while another assumes latitude comes first. Both numbers can look plausible, yet the resulting point may appear in the wrong region or even the wrong continent.
Use named properties such as latitude and longitude when designing an ordinary JSON object. If a format requires an ordered pair, state the order prominently and repeat it in the field description and examples.
State units and reference system
Coordinates commonly use angular degrees, but a dataset should say so rather than leave the unit implicit. It should also identify the coordinate reference system or datum when that affects interoperability. Two coordinate pairs may use similar numbers while referring to slightly different reference frameworks.
A useful description might say that latitude and longitude are decimal degrees in a named reference system, with latitude ranging from south to north and longitude from west to east. Include the sign convention: negative longitude commonly indicates west of the prime meridian.
Make invalid values visible
Check values against the expected range before publishing. Latitude in degrees must fall between -90 and 90, and longitude between -180 and 180. Range checks will not catch every swapped pair, since many swapped values are also numerically valid, so add geographic sanity checks where the dataset has a known coverage area.
Keep missing coordinates distinct from a location at zero degrees. A null or absent coordinate should follow the schema’s missing-value rules; do not use 0,0 as a secret unknown marker.
Choose a representation users can test
For an API object, a structure like {"latitude": 47.6, "longitude": -122.3} makes the axes explicit. For a GeoJSON-style position array, consumers need to follow that format’s defined axis order rather than assume the object convention. Name the format in the documentation and provide a real example.
Finally, plot one known point during validation. A simple map check can expose a swapped axis or sign mistake that type validation misses. Clear naming, documented order, and a reference-system statement make coordinates safer to combine and visualize.