Giter VIP home page Giter VIP logo

polyline's Introduction

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)].

polyline's People

Contributors

asmfreak avatar flc avatar frederickjansen avatar perrygeo avatar sgillies avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.