Skip to main content

A Python implementation of Google's Encoded Polyline Algorithm Format.

Project description


polyline is a Python implementation of Google’s Encoded Polyline Algorithm Format ( It is essentially a port of built with Python 2 and 3 support in mind.


polyline can be installed using pip or easy_install:

$ pip install polyline
$ easy_install polyline

API Documentation


To get the encoded polyline representation of a given set of coordinates:

import polyline
polyline.encode([(38.5, -120.2), (40.7, -120.9), (43.2, -126.4)], 5)

This should return _p~iF~ps|U_ulL~ugC_hgN~eq`@.

You can set the required precision with the optional precision parameter. The default value is 5.


To get a set of coordinates represented by a given encoded polyline string:

import polyline

This should return [(40.63179, -8.65708), (40.62855, -8.65693)].

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
polyline-1.3.2-py2.py3-none-any.whl (4.8 kB) Copy SHA256 hash SHA256 Wheel py2.py3
polyline-1.3.2.tar.gz (5.1 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page