Coordinate order
Latitude comes first in request parameters, spreadsheets and every human-facing field. GeoJSON puts longitude first.
Swapped coordinates are the most common reason a lookup lands in the wrong place or is rejected. BuddyGeo follows one rule everywhere a person types or reads a coordinate, and the GeoJSON standard wherever GeoJSON is produced.
The rule
| Where | Order | Example for the CN Tower |
|---|---|---|
| Query parameters | Named, so order does not matter: lat and lon | lat=43.6426&lon=-79.3871 |
| Pasted pairs, playground inputs, logs | latitude, longitude | 43.6426, -79.3871 |
JSON responses (query, result.location) | Named fields lat and lon | { "lat": 43.642196, "lon": -79.386628 } |
result.bounding_box | [south, north, west, east] | [43.641657, 43.642735, -79.387373, -79.385883] |
| GeoJSON geometry | [longitude, latitude] | [-79.386628, 43.642196] |
All coordinates are WGS84 decimal degrees. Latitude runs from -90 to 90, longitude from -180 to 180. South and west are negative.
GeoJSON is the exception
GeoJSON (RFC 7946) orders positions as [longitude, latitude], the opposite of what people usually write. The GeoJSON view of the reverse playground and any GeoJSON you build from a response follow the standard:
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-79.386628, 43.642196]
},
"properties": {
"formatted": "290 Bremner Boulevard, Toronto, ON M5V 3L9, Canada"
}
}If you convert a BuddyGeo result into GeoJSON yourself, write [result.location.lon, result.location.lat].
How swapped values are caught
-
Out-of-range latitude. A latitude outside -90 to 90 is rejected with
400 invalid_coordinates. When the longitude you sent would fit as a latitude, the message says the two may be swapped. Tokyo Tower with its values exchanged:curl "https://api.buddygeo.com/v1/reverse?lat=139.7454&lon=35.6586" \ -H "X-API-Key: YOUR_API_KEY"The
errorobject of the response:{ "code": "invalid_coordinates", "message": "Latitude 139.7454 is outside -90 to 90. Latitude and longitude may be swapped.", "next_step": "Send lat between -90 and 90 and lon between -180 and 180 as decimal degrees, latitude first.", "field": "lat" } -
Swaps that stay in range are not errors.
lat=-79.3871&lon=43.6426is the CN Tower pair exchanged, and it is also a valid point in Antarctica. The API cannot know which one you meant, so it answers for the point you sent: nothing is mapped there,resultisnulland no credit is charged. If a result isnullwhere you expected a city, check the order first. -
Spreadsheets. The bulk wizard inspects the mapped columns and warns when the values strongly suggest that latitude and longitude are swapped. The swapped-columns sample shows the warning.
-
The map. In the playground the submitted point and the returned point are drawn separately. A marker in the ocean or on the wrong continent is the quickest signal.
Accepted input formats
Human inputs (the playground field, spreadsheet cells) accept:
43.6426, -79.3871,43.6426 -79.3871or43.6426;-79.3871- A decimal comma in a single cell, such as
43,6426 - A trailing degree sign, such as
43.6426°
Degrees-minutes-seconds (43°38'33"N) and hemisphere letters are not parsed: convert them to signed decimal degrees first.
Open in the app
Reverse playground
Latitude and longitude are separately labeled; the map shows both points.
GeoJSON view
The same result with longitude first.
Bulk wizard
Map the latitude and longitude columns of a spreadsheet.
Related guides
Reverse geocoding
GET /v1/reverse turns a latitude and longitude into the nearest mapped address, with its components, its own coordinate and an explanation of the match.
Bulk processing
Add coordinates to a spreadsheet of addresses, or addresses to a spreadsheet of coordinates, in the upload wizard or through the /v1/batch endpoints. Preview is free; only matched rows cost a credit.
Troubleshooting
Fix the problems that come up most often - 401 after a rotation, 429 bursts, swapped coordinates, no match over water - and collect what support needs.
Bulk processing
Add coordinates to a spreadsheet of addresses, or addresses to a spreadsheet of coordinates, in the upload wizard or through the /v1/batch endpoints. Preview is free; only matched rows cost a credit.
Languages
Ask for results in a language with the lang parameter, and read result.language to see which language you received.