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 eachencode
,decode
pair against canonical test cases and compares the results.
- Ruby
- https://github.com/joshuaclayton/polylines
- JavaScript
- https://github.com/mapbox/polyline
- https://github.com/jieter/Leaflet.encoded
- Python
- https://github.com/frederickjansen/polyline
- 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
- Create a directory in the format
organization-reponame
. For instance, the repositorymapbox/polyline
lives inmapbox-polyline
. - Create
encode
anddecode
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 - Add the new implementation to the list of implementations in
test.py
- Test the new implementation by running
python test.py
- Confirm that the test case is absolutely true. The Google polyline utility is our authoritative implementation.
- Add the pair of
input
andoutput
tofixtures/canon.json
- Run
python test.py
to confirm behavior
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.