# Coordinates & formats

> Wayline takes coordinates in lat,lng order as strings, objects or arrays. Learn the accepted formats, precision, units and the most common mistakes.

Source: https://www.wayline.cloud/docs/concepts/coordinates

## Order: latitude first

Wayline uses **`lat,lng`** — the same order as Google Maps. `23.7925,90.4078` is Gulshan, Dhaka.

GeoJSON and Mapbox use `lng,lat`. If you copy coordinates from a GeoJSON file, swap them. Swapped coordinates usually return `OUT_OF_COVERAGE` because the point lands in the wrong part of the world.

## Accepted formats

| Format | Example | Where |
|---|---|---|
| String | `"23.7925,90.4078"` | Query parameters and JSON bodies |
| Object | `{"lat": 23.7925, "lng": 90.4078}` | JSON bodies |
| Array | `[23.7925, 90.4078]` | JSON bodies (`[lat, lng]`) |

Lists in query strings (waypoints, Google-compatible `origins`) are pipe-separated: `23.7925,90.4078|23.733,90.4172`.

## Ranges and precision

- Latitude must be between −90 and 90; longitude between −180 and 180. Out-of-range values return `INVALID_COORDINATE`.
- Six decimal places (~0.1 m) is more than enough. Extra precision is accepted but does not change results.

## Response coordinates

Responses return coordinates as `[lat, lng]` arrays. Route geometry in GeoJSON follows the GeoJSON standard and is **`[lng, lat]`**; encoded polylines decode to `lat,lng` pairs.

## Snapping

Every input point is snapped to the nearest drivable road before routing. Each response reports the snapped location and `distance_to_road_meters`. Large values (for example > 100 m) often indicate a bad GPS fix or a point inside a park or building; responses may include the warning `POINT_FAR_FROM_ROAD`.

## Units

Distances are always returned in meters; durations in seconds. Pass `units=imperial` to also receive `distance_miles` and readable text like `6.5 mi`.
