All Projects → frederickjansen → polyline

frederickjansen / polyline

Licence: MIT License
A Python implementation of Google's Encoded Polyline Algorithm Format.

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Labels

Projects that are alternatives of or similar to polyline

node-google-polyline
Encode / decode Google's polyline format
Stars: ✭ 35 (-62.37%)
Mutual labels:  polyline
Dual-color-Polyline-Animation
This library will help to show the polyline in dual color similar as Uber.
Stars: ✭ 73 (-21.51%)
Mutual labels:  polyline
leaflet-routeboxer
Google RouteBoxer implementation for Leaflet
Stars: ✭ 39 (-58.06%)
Mutual labels:  polyline
svg2polylines
Rust library to convert SVG data to a list of flattened polylines. Also includes FFI bindings.
Stars: ✭ 16 (-82.8%)
Mutual labels:  polyline
polliwog
2D and 3D computational geometry library
Stars: ✭ 22 (-76.34%)
Mutual labels:  polyline
rectdetect
Realtime rectangle detector with GPGPU
Stars: ✭ 51 (-45.16%)
Mutual labels:  polyline
geofiddle
Geometric conversions between different formats and projections
Stars: ✭ 15 (-83.87%)
Mutual labels:  polyline
geometry-library
PHP Geometry Library provides utility functions for the computation of geometric data on the surface of the Earth. Code ported from Google Maps Android API.
Stars: ✭ 132 (+41.94%)
Mutual labels:  polyline
polyline ex
No description or website provided.
Stars: ✭ 20 (-78.49%)
Mutual labels:  polyline

polyline

http://img.shields.io/travis/hicsail/polyline.svg?style=flat http://img.shields.io/pypi/v/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 (lat, lon) 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.

You can encode (lon, lat) tuples by setting geojson=True.

Decoding

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

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

This should return [(40.63179, -8.65708), (40.62855, -8.65693)] in (lat, lon) order.

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

You can decode into (lon, lat) tuples by setting geojson=True.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].