{"id":20085406,"url":"https://github.com/klaxit/fast-polylines","last_synced_at":"2025-10-23T19:02:06.792Z","repository":{"id":45065778,"uuid":"85496346","full_name":"klaxit/fast-polylines","owner":"klaxit","description":"🚀 Fast \u0026 easy Google polylines","archived":false,"fork":false,"pushed_at":"2024-10-16T21:40:07.000Z","size":58,"stargazers_count":45,"open_issues_count":0,"forks_count":13,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-06-18T02:03:52.127Z","etag":null,"topics":["geolocation","google-maps-api","polyline","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/klaxit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-19T17:45:22.000Z","updated_at":"2024-12-24T06:06:04.000Z","dependencies_parsed_at":"2024-11-13T16:06:41.292Z","dependency_job_id":null,"html_url":"https://github.com/klaxit/fast-polylines","commit_stats":{"total_commits":35,"total_committers":10,"mean_commits":3.5,"dds":0.5428571428571429,"last_synced_commit":"6bc7e46d98ef6c3d8321587d5e59932390eb7797"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/klaxit/fast-polylines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaxit%2Ffast-polylines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaxit%2Ffast-polylines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaxit%2Ffast-polylines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaxit%2Ffast-polylines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klaxit","download_url":"https://codeload.github.com/klaxit/fast-polylines/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaxit%2Ffast-polylines/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265871376,"owners_count":23842025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geolocation","google-maps-api","polyline","ruby"],"created_at":"2024-11-13T15:55:51.204Z","updated_at":"2025-10-23T19:02:06.693Z","avatar_url":"https://github.com/klaxit.png","language":"Ruby","readme":"# Fast Polylines\n\n[![Gem](https://img.shields.io/gem/v/fast-polylines)](https://rubygems.org/gems/fast-polylines)\n[![Continuous Integration Status](https://github.com/klaxit/fast-polylines/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/klaxit/fast-polylines/actions?query=workflow%3A%22Continuous+Integration%22)\n\nImplementation of the [Google polyline algorithm][algorithm].\n\n**BREAKING CHANGES:** The version 2 of FastPolylines includes breaking changes, see [Migrate from V1](#migrate-from-V1)\n\nAbout **300x faster encoding and decoding** than [Joshua Clayton's gem][polylines].\n\n`make benchmark` on a MacBook pro 13 - 2,3 GHz Intel Core i5:\n\n```\n——————————————————————————————— ENCODING ————————————————————————————————\n\nWarming up --------------------------------------\n           Polylines   310.000  i/100ms\n     FastPolylinesV1     2.607k i/100ms\n     FastPolylinesV2    59.833k i/100ms\nCalculating -------------------------------------\n           Polylines      2.957k (± 5.9%) i/s -     14.880k in   5.049867s\n     FastPolylinesV1     25.644k (± 5.8%) i/s -    127.743k in   4.999954s\n     FastPolylinesV2    682.981k (± 7.7%) i/s -      3.410M in   5.025952s\n\nComparison:\n     FastPolylinesV2:   682980.7 i/s\n     FastPolylinesV1:    25643.7 i/s - 26.63x  slower\n           Polylines:     2957.1 i/s - 230.97x  slower\n\n\n———————————————————————————————  DECODING ————————————————————————————————\n\nWarming up --------------------------------------\n           Polylines   127.000  i/100ms\n     FastPolylinesV1     1.225k i/100ms\n     FastPolylinesV2    40.667k i/100ms\nCalculating -------------------------------------\n           Polylines      1.289k (± 6.1%) i/s -      6.477k in   5.046552s\n     FastPolylinesV1     15.445k (± 4.4%) i/s -     77.175k in   5.006896s\n     FastPolylinesV2    468.413k (± 7.8%) i/s -      2.359M in   5.068936s\n\nComparison:\n     FastPolylinesV2:   468412.8 i/s\n     FastPolylinesV1:    15445.4 i/s - 30.33x  slower\n           Polylines:     1288.8 i/s - 363.46x  slower\n```\n\n## Install\n\n```bash\ngem install fast-polylines\n```\n\nor in your `Gemfile`:\n\n```ruby\ngem \"fast-polylines\", \"~\u003e 2.0.0\"\n```\n\n## Usage\n\n```ruby\nrequire \"fast_polylines\"\n\nFastPolylines.encode([[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]])\n# \"_p~iF~ps|U_ulLnnqC_mqNvxq`@\"\n\nFastPolylines.decode(\"_p~iF~ps|U_ulLnnqC_mqNvxq`@\")\n# [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]]\n```\n\n## Advanced usage\n\n**Use a different precision**\n\nDefault precision is `5` decimals, to use a precision of `6`:\n\n```ruby\nFastPolylines.encode([[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]], 6)\n# \"_izlhA~rlgdF_{geC~ywl@_kwzCn`{nI\"\n\nFastPolylines.decode(\"_izlhA~rlgdF_{geC~ywl@_kwzCn`{nI\", 6)\n# [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]]\n```\n\nThe precision max is `13`.\n\n## Migrate from V1\n\n**TL;DR:**\n\n```ruby\n# before\nrequire \"fast-polylines\"\nFastPolylines::Encoder.encode([[1.2, 1.2], [2.4, 2.4]], 1e6)\n# after\nrequire \"fast_polylines\"\nFastPolylines.encode([[1.2, 1.2], [2.4, 2.4]], 6)\n```\n\n**Detailled:**\n\nThe new version of `FastPolylines` doesn't support precision more than `1e13`,\nyou should not consider using it anyway since [it is way too precise][xkcd].\n\n`Encoder` and `Decoder` modules are deprecated in favor of the single parent\nmodule. Even though you can still use those, a deprecation warning will be\nprinted.\n\nThe precision is now an integer representing the number of decimals. It is\nslightly smaller, and mostly this will avoid having any float value as\nprecision.\n\nThe file name to require is now snake_cased, you'll have to require\n`fast_polylines`. The gem name stays the same however.\n\n## Run the Benchmark\n\nYou can run the benchmark with `make benchmark`.\n\n## Contributing\n\n```bash\ngit clone git@github.com:klaxit/fast-polylines\ncd fast-polylines\nbundle install\n# Implement a feature, resolve a bug...\nmake rubocop\nmake test\ngit commit \"My new feature!\"\n# Make a PR\n```\n\nThere is a `make console` command as well to open a ruby console with the\ncurrent version loaded.\n\n[And here's a good starting point for Ruby C extensions knowledge.][ruby-c]\n\n## License\n\nPlease see LICENSE\n\n[algorithm]: https://code.google.com/apis/maps/documentation/utilities/polylinealgorithm.html\n[polylines]: https://github.com/joshuaclayton/polylines\n[xkcd]: https://xkcd.com/2170/\n[ruby-c]: https://github.com/ruby/ruby/blob/master/doc/extension.rdoc\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklaxit%2Ffast-polylines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklaxit%2Ffast-polylines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklaxit%2Ffast-polylines/lists"}