Skip to content

Cross-library cross-language test for polyline encoding and decoding

Notifications You must be signed in to change notification settings

mapbox/polyline-spectrum

Repository files navigation

polyline-spectrum

CircleCI

A spectrum test for implementations of the Google Encoded Polyline algorithm. This test compares multiple implementations across multiple languages:

  • Each implementation has a command-line utility called encode that takes a JSON string of a coordinate array in [latitude, longitude] order and transforms it into an encoded polyline, which it prints to stdout without any newlines or other information.
  • Each implementation has a command-line utility called decode that takes an encoded polyline string and prints a JSON-encoded coordinate array to stdout without any newlines or other information.
  • test.py runs each encode, decode pair against canonical test cases and compares the results.

Currently-tracked implementations

Contributing a new implementation

  1. If the implementation uses a package manager like pip or npm, add the dependency to one of the dependency documents, like package.json. a. If that introduces a new dependency manager to the mix, add the install command to setup.py
  2. Create a directory in the format organization-reponame. For instance, the repository mapbox/polyline lives in mapbox-polyline.
  3. Create encode and decode CLI commands in that directory. The files should be executable (chmod +x), and have hashbang lines that find the correct interpreter for them to run
  4. Add the new implementation to the list of implementations in test.py
  5. Test the new implementation by running python test.py

Contributing a new test case

  1. Confirm that the test case is absolutely true. The Google polyline utility is our authoritative implementation.
  2. Add the pair of input and output to fixtures/canon.json
  3. Run python test.py to confirm behavior

How do I post an issue?

This is a pull requests for everything repository: if you need a new implementation covered, please follow the guide above to add it. Same if you find a bug, or need an additional test.

About

Cross-library cross-language test for polyline encoding and decoding

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published