polylines.cr alternatives and similar shards
Based on the "Compression" category.
Alternatively, view polylines.cr alternatives based on common mentions on social networks and blogs.
InfluxDB - Purpose built for real-time analytics at any scale.
Do you think we are missing an alternative of polylines.cr or a related project?
Popular Comparisons
README
Crystal Lang Polylines
A Crystal implementation of the Google polyline algorithm.
Greatly inspired by the Ruby implementation fast-polylines, it is mostly existing for performance comparison between Ruby C extensions and Crystal!
If you are curious: encoding is roughly the same, decoding is way faster in Crystal.
If you are even more curious, make benchmark
here and in fast-polylines ๐.
With a MacBook pro 1,4 GHz i5, here's the result:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ENCODING โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CrystalPolylines 706.82k ( 1.41ยตs) (ยฑ 4.42%) 466B/op fastest
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ DECODING โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CrystalPolylines 1.43M (699.73ns) (ยฑ 3.21%) 1.62kB/op fastest
Installation
Add the dependency to your shard.yml
:
dependencies:
polylines:
github: BuonOmo/polylines.cr
Run shards install
Usage
require "polylines"
Polylines.encode([{lat: 38.5, lng: -120.2}, {lat: 40.7, lng: -120.95}])
Polylines.encode([[38.5, -120.2], [40.7, -120.95]])
Polylines.encode([{38.5, -120.2}, {40.7, -120.95}])
# => "_p~iF~ps|U_ulLnnqC"
Polylines.decode("_p~iF~ps|U_ulLnnqC")
# => [{lat: 38.5, lng: -120.2}, {lat: 40.7, lng: -120.95}]
Polylines.encode([{lat: 12.1232493, lng: 2.9481493}, {lat: 13.8474392, lng: 16.8373924}], 7)
# => "yemffFi`lfw@uqj{_@}gi|gG"
Polylines.decode("yemffFi`lfw@uqj{_@}gi|gG", 7)
# => [{lat: 12.1232493, lng: 2.9481493}, {lat: 13.8474392, lng: 16.8373924}]
Contributing
- Fork it (BuonOmo/polylines.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request