geospatial 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -10
- data/lib/geospatial/location.rb +4 -0
- data/lib/geospatial/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af57f14cdc085ce808e8462af23af0e269797b86
|
4
|
+
data.tar.gz: f7bc6d182e0b5366a6ada00112c555a35576977b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20a32b175c72f9989a8ffe6f29fa06637af22fda65d8d61c240d25c701268468248e4e52bc719b33e9f1c3396702fac0c49924e4878fae2d8ff07af8a4564251
|
7
|
+
data.tar.gz: 471174aee8a1270436599bdfed01d623ff9a3d34dbce7b7221d63b9e266fbfdc5e4da8bd0ca990342a010b68281b7a3fddbd6f5fbfad33757de2ed05fa155c87
|
data/README.md
CHANGED
@@ -34,26 +34,42 @@ Or install it yourself as:
|
|
34
34
|
|
35
35
|
The simplest way to use this library is to use the built in `Map`:
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
```ruby
|
38
|
+
map = Geospatial::Map.new
|
39
|
+
map << Geospatial::Location.new(170.53, -43.89) # Lake Tekapo, New Zealand.
|
40
|
+
map << Geospatial::Location.new(170.45, -43.94) # Lake Alex, New Zealand.
|
41
|
+
map << Geospatial::Location.new(151.21, -33.85) # Sydney, Australia.
|
41
42
|
|
42
|
-
|
43
|
+
map.sort! # or assume an ordered database index.
|
43
44
|
|
44
|
-
|
45
|
+
new_zealand = Geospatial::Box.from_bounds(Vector[166.0, -48.0], Vector[180.0, -34.0])
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
points = subject.query(new_zealand)
|
48
|
+
expect(points).to include(lake_tekapo, lake_alex)
|
49
|
+
expect(points).to_not include(sydney)
|
50
|
+
```
|
49
51
|
|
50
52
|
At a lower level you can use the method in the `Geospatial::Hilbert` module to `map`, `unmap` and `traverse` the Hilbert mapping.
|
51
53
|
|
54
|
+
### Computing a Hilbert Index
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
#!/usr/bin/env ruby
|
58
|
+
require 'geospatial/map'
|
59
|
+
require 'geospatial/dimensions'
|
60
|
+
require 'geospatial/hilbert/curve'
|
61
|
+
|
62
|
+
map = Geospatial::Map.for_earth(30)
|
63
|
+
coordinate = ARGV.collect(&:to_f)
|
64
|
+
index = map.hash_for_coordinates(coordinate)
|
65
|
+
puts index
|
66
|
+
```
|
67
|
+
|
52
68
|
### Geotemporal Indexes
|
53
69
|
|
54
70
|
The Hilbert curve is multi-dimensional and therefore can represent multi-dimensional data, e.g. latitude, longitude and time, in a single index. The curve expands uniformly in all dimensions, so you can't control the precision of the dimensions independently.
|
55
71
|
|
56
|
-
Mathematically speaking, it's possible to compose curves together to form curves of different precision/properties. However, how these fit together generally is a bit more complex, especially in terms of exploring the curve via traversal.
|
72
|
+
Mathematically speaking, it's possible to [compose curves together](https://github.com/cne1x/sfseize) to form curves of different precision/properties. However, how these fit together generally is a bit more complex, especially in terms of exploring the curve via traversal.
|
57
73
|
|
58
74
|
## Contributing
|
59
75
|
|
data/lib/geospatial/location.rb
CHANGED
data/lib/geospatial/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geospatial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|