lat lon lat lon lat lon

Geospatial API designers have yet to settle on a standard for representing a series of points in a request URL.

Here’s how some APIs handle it.

Google Maps Elevation API

A locations query argument, with either a polyline prefixed by enc:


or | delimited lat,lon pairs



The final component of the URL, as either a polyline wrapped in polyline()


or ; delimited lon,lat pairs


The Mapbox geocoding API uses a similar format.


A json query argument, that takes either a polyline in a encoded_polyline key

?json={"encoded_polyline": "<polyline>"}

or an array of points in a shape key:



Repeated point query arguments in lat,lon order


HERE routing

Repeated via query arguments in lat,lon order


Some notes

  • Many APIs (like Open Topo Data) use one of the above formats. The Google Maps format has become fairly common among elevation APIs, likely because it came first.
  • This post was inspired by Tom MacWright’s summary of the lat,lon vs lon,lat ordering inconsistency.