uk_county_locator 0.1.1 → 0.1.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/README.md +0 -4
- data/lib/uk_county_locator/polylines_service.rb +3 -8
- data/lib/uk_county_locator/version.rb +1 -1
- data/uk_county_locator.gemspec +0 -1
- metadata +2 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 27a04a402e7e930016fd57dc017651e6d1af7ab70cf3beab8fc22516523d5029
|
|
4
|
+
data.tar.gz: a03327e72222c9be5125118eeaea3d8215dfd5ff614cff4ed0e826ea019c5a2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 52f26ec0c57ea50997202a192cd8aa44561f9da8bdc8f172702cf96dafe119d68aab36d125c1649eee6467c338ac7f8903f46ba85b1e4f36e0b9d0f7bde4e258
|
|
7
|
+
data.tar.gz: e8cbaf337486948decfc9ee7403bb182c25f075c865d5407703863b9549519978d4119f52292407ef40e3c8f7c78622550e3219c84a0d14c17422388e9ed353d
|
data/README.md
CHANGED
|
@@ -200,10 +200,6 @@ The data to compile these polygon areas has been taken from a number of sources,
|
|
|
200
200
|
- [UK Ceremonial Counties](https://github.com/evansd/uk-ceremonial-counties/blob/master/uk-ceremonial-counties.geojson)
|
|
201
201
|
- [The Association of British Counties](https://abcounties.com/)
|
|
202
202
|
|
|
203
|
-
## Performance Optimization
|
|
204
|
-
|
|
205
|
-
The gem utilizes the `Parallel` gem to speed up polygon lookups.
|
|
206
|
-
|
|
207
203
|
## Compatibility
|
|
208
204
|
|
|
209
205
|
The gem is tested against multiple versions of Rails using Appraisal, ensuring broad compatibility with different Ruby on Rails applications.
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
require 'polylines'
|
|
4
4
|
require 'geokit'
|
|
5
|
-
require 'parallel'
|
|
6
5
|
|
|
7
6
|
# PolylinesService handles the decoding of polygon polyline data and provides
|
|
8
7
|
# functionality to check if a given point (latitude, longitude) lies within
|
|
9
|
-
# any of the provided polygons.
|
|
10
|
-
# polygons using parallel processing to improve performance.
|
|
8
|
+
# any of the provided polygons.
|
|
11
9
|
class PolylinesService
|
|
12
10
|
def initialize(lat:, lng:)
|
|
13
11
|
@point = Geokit::LatLng.new(lat, lng)
|
|
@@ -20,12 +18,9 @@ class PolylinesService
|
|
|
20
18
|
def point_inside_polygon?(polygons)
|
|
21
19
|
return nil if @point.nil?
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
polygons.detect do |name, polygon|
|
|
24
22
|
geo_polygon = Geokit::Polygon.new(polygon_to_array(polygon: polygon))
|
|
25
|
-
|
|
26
23
|
geo_polygon.contains?(@point) ? name : nil
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
result.compact.first
|
|
24
|
+
end.first
|
|
30
25
|
end
|
|
31
26
|
end
|
data/uk_county_locator.gemspec
CHANGED
|
@@ -35,7 +35,6 @@ Gem::Specification.new do |spec|
|
|
|
35
35
|
|
|
36
36
|
# Uncomment to register a new dependency of your gem
|
|
37
37
|
spec.add_dependency 'geokit', '>= 1.0', '< 3.0'
|
|
38
|
-
spec.add_dependency 'parallel', '>= 1.0', '< 3.0'
|
|
39
38
|
spec.add_dependency 'polylines', '>= 0.1.1', '< 1.0'
|
|
40
39
|
|
|
41
40
|
# For more information and examples about making a new gem, check out our
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: uk_county_locator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Edward Beesley
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-03
|
|
11
|
+
date: 2025-07-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: geokit
|
|
@@ -30,26 +30,6 @@ dependencies:
|
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
32
|
version: '3.0'
|
|
33
|
-
- !ruby/object:Gem::Dependency
|
|
34
|
-
name: parallel
|
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - ">="
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '1.0'
|
|
40
|
-
- - "<"
|
|
41
|
-
- !ruby/object:Gem::Version
|
|
42
|
-
version: '3.0'
|
|
43
|
-
type: :runtime
|
|
44
|
-
prerelease: false
|
|
45
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
46
|
-
requirements:
|
|
47
|
-
- - ">="
|
|
48
|
-
- !ruby/object:Gem::Version
|
|
49
|
-
version: '1.0'
|
|
50
|
-
- - "<"
|
|
51
|
-
- !ruby/object:Gem::Version
|
|
52
|
-
version: '3.0'
|
|
53
33
|
- !ruby/object:Gem::Dependency
|
|
54
34
|
name: polylines
|
|
55
35
|
requirement: !ruby/object:Gem::Requirement
|