Skip to main content

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

Project description

polyline

http://img.shields.io/travis/hicsail/polyline.svg?style=flat http://img.shields.io/pypi/v/polyline.svg?style=flat http://img.shields.io/pypi/dm/polyline.svg?style=flat

polyline is a Python implementation of Google’s Encoded Polyline Algorithm Format (http://goo.gl/PvXf8Y). It is essentially a port of https://github.com/mapbox/polyline built with Python 2 and 3 support in mind.

Installation

polyline can be installed using pip or easy_install:

$ pip install polyline
or
$ easy_install polyline

API Documentation

Encoding

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.

Decoding

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

import polyline
polyline.decode('u{~vFvyys@fS]')

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

Project details


Download files

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

Source Distribution

polyline-1.3.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polyline-1.3.1-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file polyline-1.3.1.tar.gz.

File metadata

  • Download URL: polyline-1.3.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for polyline-1.3.1.tar.gz
Algorithm Hash digest
SHA256 02fa0f6dd41fc53c0967c715a15a49d0003840ffd7b74d7ba0084dd07d164c34
MD5 419dee1c405395913671aaffd797b7da
BLAKE2b-256 d65118412cd3977e705f35561b4f286a315c6340654e8d6b4dff0b4a6c04af07

See more details on using hashes here.

File details

Details for the file polyline-1.3.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for polyline-1.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d6fc153fc503f7cb9d97ac90e5980ded80b045cb449a85c28d2a39671024e728
MD5 a51672db92543e8fb79321388cf522b8
BLAKE2b-256 ecb1a018a0f9aa9800b81a83e9b8bcdde51d9284f7ac92ed0e7d961839e20742

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page