diff --git a/docs/surface.md b/docs/surface.md
index 8fcbb77..c6e9676 100644
--- a/docs/surface.md
+++ b/docs/surface.md
@@ -86,7 +86,7 @@ contours).
 ...    polyline=True, zoom=12, interpolate=False)
 >>> points = response.geojson()
 >>> [f['properties']['ele'] for f in points['features']]
-[None, None, None]
+[2190, 2190, 2160]
 
 ```
 
diff --git a/mapbox/encoding.py b/mapbox/encoding.py
index 0674d51..6190ea6 100644
--- a/mapbox/encoding.py
+++ b/mapbox/encoding.py
@@ -68,12 +68,13 @@ def encode_waypoints(features, min_limit=None, max_limit=None, precision=6):
     return ';'.join(coords)
 
 
-def encode_polyline(features, zoom_level=18):
+def encode_polyline(features):
     """Encode and iterable of features as a polyline
     """
     points = list(read_points(features))
+    latlon_points = [(x[1], x[0]) for x in points]
     codec = PolylineCodec()
-    return codec.encode(points)
+    return codec.encode(latlon_points)
 
 
 def encode_coordinates_json(features):

Encoded polylines in wrong coordinate order
Currently, we take the geojson point array and encode the point directly in [lon, lat] order. Polylines should be [lat, lon].
diff --git a/tests/test_encoding.py b/tests/test_encoding.py
index fa15f14..9326ae6 100644
--- a/tests/test_encoding.py
+++ b/tests/test_encoding.py
@@ -113,7 +113,7 @@ def test_unknown_object():
 
 
 def test_encode_polyline():
-    expected = "vdatOwp_~EhupD{xiA"
+    expected = "wp_~EvdatO{xiAhupD"
     assert expected == encode_polyline(gj_point_features)
     assert expected == encode_polyline(gj_multipoint_features)
     assert expected == encode_polyline(gj_line_features)
diff --git a/tests/test_surface.py b/tests/test_surface.py
index 05bd2c7..2ba08cd 100644
--- a/tests/test_surface.py
+++ b/tests/test_surface.py
@@ -55,7 +55,7 @@ def test_surface_geojson():
 @responses.activate
 def test_surface_params():
 
-    params = "&encoded_polyline=~kbkTss%60%7BEQeAHu%40&zoom=16&interpolate=false"
+    params = "&encoded_polyline=ss%60%7BE~kbkTeAQu%40H&zoom=16&interpolate=false"
     responses.add(
         responses.GET,
         'https://api.mapbox.com/v4/surface/mapbox.mapbox-terrain-v1.json?access_token=pk.test&fields=ele&layer=contour&geojson=true' + params,

pip install -e .[test]
parse_log_pytest
requirements.txt
pytest pytest-cov
pip install -U pip
3.5
requirements/base.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
boto3==1.23.10
botocore==1.26.10
CacheControl==0.12.14
certifi==2021.5.30
charset-normalizer==2.0.12
click==8.0.4
click-plugins==1.1.1
cligj==0.7.2
coverage==6.2
coveralls==3.3.1
distlib==0.3.9
docopt==0.6.2
filelock==3.4.1
idna==3.10
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
iso3166==2.1.1
jmespath==0.10.0
-e git+https://github.com/mapbox/mapbox-sdk-py.git@2c11fdee6eee83ea82398cc0756ac7f35aada801#egg=mapbox
msgpack==1.0.5
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
python-dateutil==2.9.0.post0
requests==2.27.1
responses==0.17.0
s3transfer==0.5.2
six==1.17.0
toml==0.10.2
tomli==1.2.3
tox==3.28.0
typing_extensions==4.1.1
uritemplate==4.1.1
uritemplate.py==3.0.2
urllib3==1.26.20
virtualenv==20.17.1
zipp==3.6.0

name: mapbox-sdk-py
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - boto3==1.23.10
      - botocore==1.26.10
      - cachecontrol==0.12.14
      - charset-normalizer==2.0.12
      - click==8.0.4
      - click-plugins==1.1.1
      - cligj==0.7.2
      - coverage==6.2
      - coveralls==3.3.1
      - distlib==0.3.9
      - docopt==0.6.2
      - filelock==3.4.1
      - idna==3.10
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - iso3166==2.1.1
      - jmespath==0.10.0
      - msgpack==1.0.5
      - packaging==21.3
      - pip==21.3.1
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - python-dateutil==2.9.0.post0
      - requests==2.27.1
      - responses==0.17.0
      - s3transfer==0.5.2
      - six==1.17.0
      - toml==0.10.2
      - tomli==1.2.3
      - tox==3.28.0
      - typing-extensions==4.1.1
      - uritemplate==4.1.1
      - uritemplate-py==3.0.2
      - urllib3==1.26.20
      - virtualenv==20.17.1
      - zipp==3.6.0
prefix: /opt/conda/envs/mapbox-sdk-py

tests/test_encoding.py::test_encode_polyline tests/test_surface.py::test_surface_params
tests/test_encoding.py::test_read_geojson_features tests/test_encoding.py::test_geo_interface tests/test_encoding.py::test_encode_waypoints tests/test_encoding.py::test_encode_limits tests/test_encoding.py::test_unsupported_geometry tests/test_encoding.py::test_unknown_object tests/test_encoding.py::test_encode_coordinates_json tests/test_surface.py::test_surface tests/test_surface.py::test_surface_geojson
docs/surface.md mapbox/encoding.py
docs/surface.md mapbox/encoding.py