fast-polylines 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +7 -0
- data/CHANGELOG.md +8 -1
- data/README.md +2 -2
- data/ext/fast_polylines/fast_polylines.c +39 -2
- data/lib/fast_polylines/version.rb +1 -1
- data/lib/fast_polylines.rb +6 -4
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd26a9400977f70c17d07fbbc97484bc33fa5c2a876ec72739379b9650b00403
|
4
|
+
data.tar.gz: b2caa0bcaa90d269bd92b948b01ecc080c006a1304500edd1435513671a2b465
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fb523730effba875e1eb7f557904bfdf11f44e419cbea433f11d29c73587b29956339075ac3b6af8f7e83de2a5b17241d93bb806f703a69f2ca81ff439fcd2a
|
7
|
+
data.tar.gz: 4311f966e39d44e47fd039712549466fa29a828f7470e5c33238f8997540f95327e2befd182bc79ceebfe9c5c728e001a41cd57ab7250ea80b676023a3a8913f
|
data/.yardopts
ADDED
data/CHANGELOG.md
CHANGED
@@ -13,6 +13,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
13
13
|
|
14
14
|
### Fixed
|
15
15
|
|
16
|
+
## [2.2.2] — 2022-01-11
|
17
|
+
|
18
|
+
### Added
|
19
|
+
|
20
|
+
- C API documentation.
|
21
|
+
|
16
22
|
## [2.2.0] — 2020-11-24
|
17
23
|
|
18
24
|
### Added
|
@@ -42,7 +48,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
42
48
|
- Broken behavior when approaching the chunk size limit (#16)
|
43
49
|
|
44
50
|
|
45
|
-
[unreleased]: https://github.com/klaxit/fast-polylines/compare/v2.2.
|
51
|
+
[unreleased]: https://github.com/klaxit/fast-polylines/compare/v2.2.2...HEAD
|
52
|
+
[2.2.2]: https://github.com/klaxit/fast-polylines/compare/v2.2.0...v2.2.2
|
46
53
|
[2.2.0]: https://github.com/klaxit/fast-polylines/compare/v2.1.0...v2.2.0
|
47
54
|
[2.1.0]: https://github.com/klaxit/fast-polylines/compare/v2.0.1...v2.1.0
|
48
55
|
[2.0.1]: https://github.com/klaxit/fast-polylines/compare/v2.0.0...v2.0.1
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Fast Polylines
|
2
2
|
|
3
|
-
[](https://rubygems.org/gems/fast-polylines)
|
4
|
+
[](https://github.com/klaxit/fast-polylines/actions?query=workflow%3A%22Continuous+Integration%22)
|
5
5
|
|
6
6
|
Implementation of the [Google polyline algorithm][algorithm].
|
7
7
|
|
@@ -1,3 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* Document-module: FastPolylines
|
3
|
+
*
|
4
|
+
* Implementation of the [Google polyline algorithm](https://code.google.com/apis/maps/documentation/utilities/polylinealgorithm.html).
|
5
|
+
*
|
6
|
+
* Install it with `gem install fast-polylines`, and then:
|
7
|
+
*
|
8
|
+
* require "fast_polylines"
|
9
|
+
*
|
10
|
+
* FastPolylines.encode([[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]])
|
11
|
+
* # "_p~iF~ps|U_ulLnnqC_mqNvxq`@"
|
12
|
+
*
|
13
|
+
* FastPolylines.decode("_p~iF~ps|U_ulLnnqC_mqNvxq`@")
|
14
|
+
* # [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]]
|
15
|
+
*
|
16
|
+
* You can set an arbitrary precision for your coordinates to be encoded/decoded. It may be from 1
|
17
|
+
* to 13 decimal digits. However, 13 may be too much.
|
18
|
+
*
|
19
|
+
* [](https://www.explainxkcd.com/wiki/index.php/2170:_Coordinate_Precision)
|
20
|
+
*/
|
21
|
+
|
1
22
|
#include <ruby.h>
|
2
23
|
|
3
24
|
// An encoded number can have at most _precision_ characters. However,
|
@@ -46,7 +67,15 @@ static inline uint _get_precision(VALUE value) {
|
|
46
67
|
return (uint)precision;
|
47
68
|
}
|
48
69
|
|
49
|
-
|
70
|
+
/**
|
71
|
+
* call-seq:
|
72
|
+
* FastPolylines.decode(polyline, precision = 5) -> [[lat, lng], ...]
|
73
|
+
*
|
74
|
+
* Decode a polyline to a list of coordinates (lat, lng tuples). You may
|
75
|
+
* set an arbitrary coordinate precision, however, it **must match** the precision
|
76
|
+
* that was used for encoding.
|
77
|
+
*/
|
78
|
+
static VALUE
|
50
79
|
rb_FastPolylines__decode(int argc, VALUE *argv, VALUE self) {
|
51
80
|
rb_check_arity(argc, 1, 2);
|
52
81
|
Check_Type(argv[0], T_STRING);
|
@@ -103,7 +132,15 @@ _polyline_encode_number(char *chunks, int64_t number) {
|
|
103
132
|
return i;
|
104
133
|
}
|
105
134
|
|
106
|
-
|
135
|
+
/**
|
136
|
+
* call-seq:
|
137
|
+
* FastPolylines.encode([[lat, lng], ...], precision = 5) -> string
|
138
|
+
*
|
139
|
+
* Encode a list of coordinates to a polyline, you may give a specific precision
|
140
|
+
* if you want to retain more (or less) than 5 digits of precision. The maximum
|
141
|
+
* is 13, and may really be [too much](https://xkcd.com/2170/).
|
142
|
+
*/
|
143
|
+
static VALUE
|
107
144
|
rb_FastPolylines__encode(int argc, VALUE *argv, VALUE self) {
|
108
145
|
rb_check_arity(argc, 1, 2);
|
109
146
|
Check_Type(argv[0], T_ARRAY);
|
data/lib/fast_polylines.rb
CHANGED
@@ -3,17 +3,19 @@
|
|
3
3
|
require "fast_polylines/fast_polylines"
|
4
4
|
|
5
5
|
module FastPolylines::Encoder
|
6
|
-
|
6
|
+
# @deprecated Use {FastPolylines.encode} instead.
|
7
|
+
def self.encode(points, precision = 1e5)
|
7
8
|
warn "Deprecated use of `FastPolylines::Encoder.encode`, " \
|
8
|
-
|
9
|
+
"use `FastPolylines.encode`."
|
9
10
|
FastPolylines.encode(points, Math.log10(precision))
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
14
|
module FastPolylines::Decoder
|
14
|
-
|
15
|
+
# @deprecated Use {FastPolylines.decode} instead.
|
16
|
+
def self.decode(polyline, precision = 1e5)
|
15
17
|
warn "Deprecated use of `FastPolylines::Decoder.decode`, " \
|
16
|
-
|
18
|
+
"use `FastPolylines.decode`."
|
17
19
|
FastPolylines.decode(polyline, Math.log10(precision))
|
18
20
|
end
|
19
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast-polylines
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyrille Courtière
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-01-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: benchmark-ips
|
@@ -62,6 +62,7 @@ extensions:
|
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
64
|
- ".rspec"
|
65
|
+
- ".yardopts"
|
65
66
|
- CHANGELOG.md
|
66
67
|
- README.md
|
67
68
|
- ext/fast_polylines/extconf.rb
|
@@ -91,12 +92,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
92
|
- !ruby/object:Gem::Version
|
92
93
|
version: '0'
|
93
94
|
requirements: []
|
94
|
-
rubygems_version: 3.
|
95
|
+
rubygems_version: 3.2.3
|
95
96
|
signing_key:
|
96
97
|
specification_version: 4
|
97
98
|
summary: Fast & easy Google polylines
|
98
99
|
test_files:
|
99
|
-
- spec/spec_helper.rb
|
100
100
|
- spec/fast-polylines_spec.rb
|
101
101
|
- spec/fast_polylines_spec.rb
|
102
|
+
- spec/spec_helper.rb
|
102
103
|
- ".rspec"
|