gpx 0.8.3 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/CHANGELOG.md +10 -0
- data/README.md +18 -13
- data/gpx.gemspec +3 -1
- data/lib/gpx/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77fe925f54ad3eb792f09dc5ac6eba67e39052c9
|
4
|
+
data.tar.gz: f7a763dd97b5f38921254ae6d3ffaae2ce3d3fe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 442bb28b647d15cbb22fc9fe79aabb9ebcf37c2ae30b9dc510573b88f8d8867f693484d00ab2495820c74d892abc3be062e6bc5bd1b548504fb72b1ad36635ea
|
7
|
+
data.tar.gz: b9f1a61107b41768feee72c1aeb89b2cac7758a112576095f62f2cfe70947e680796a46b75999e61e33c69876b03c508d785a700649dca3b9cf71e85b127b469
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## [0.9.0] - 2017-01-05
|
2
|
+
|
3
|
+
* Upgrade Nokogiri deps to be more explicit, then explicitly bump the Ruby
|
4
|
+
dependency.
|
5
|
+
|
6
|
+
## [0.8.3] - 2017-01-05
|
7
|
+
|
8
|
+
* Make Track comment and description fields be `attr_accessible` (#17 via
|
9
|
+
@wallclimber21)
|
10
|
+
|
1
11
|
## [0.8.2] - 2015-08-03
|
2
12
|
|
3
13
|
* Enhance calculation of average speed (with usage of new
|
data/README.md
CHANGED
@@ -3,10 +3,6 @@
|
|
3
3
|
[<img src="https://travis-ci.org/dougfales/gpx.svg" alt="Build Status" />](https://travis-ci.org/dougfales/gpx)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/dougfales/gpx/badges/gpa.svg)](https://codeclimate.com/github/dougfales/gpx)
|
5
5
|
|
6
|
-
Copyright (C) 2006 Doug Fales doug@falesafeconsulting.com
|
7
|
-
|
8
|
-
Released under the MIT License.
|
9
|
-
|
10
6
|
## What It Does
|
11
7
|
|
12
8
|
This library reads GPX files and provides an API for reading and manipulating
|
@@ -19,9 +15,14 @@ rectangular areas within a file, and it also calculates some meta-data about
|
|
19
15
|
the tracks and points in a file (such as distance, duration, average speed,
|
20
16
|
etc).
|
21
17
|
|
18
|
+
## Requirements
|
19
|
+
|
20
|
+
As of `0.9.0`, `gpx` requires at least Ruby 2.1 to run.
|
21
|
+
|
22
22
|
## Examples
|
23
23
|
|
24
24
|
Reading a GPX file, and cropping its contents to a given area:
|
25
|
+
|
25
26
|
```ruby
|
26
27
|
gpx = GPX::GPXFile.new(:gpx_file => filename) # Read GPX file
|
27
28
|
bounds = GPX::Bounds.new(params) # Create a rectangular area to crop
|
@@ -41,28 +42,28 @@ Exporting an ActiveRecord to GPXFile (as Waypoints)
|
|
41
42
|
#
|
42
43
|
# Our active record in this example is called stop
|
43
44
|
#
|
44
|
-
|
45
|
-
# models/stop.rb
|
45
|
+
|
46
|
+
# models/stop.rb
|
46
47
|
class Stop < ActiveRecord::Base
|
47
48
|
# This model has the following attributes:
|
48
49
|
# name
|
49
50
|
# lat
|
50
51
|
# lon
|
51
52
|
# updated_at
|
52
|
-
|
53
|
+
|
53
54
|
def self.to_gpx
|
54
55
|
require 'GPX'
|
55
56
|
gpx = GPX::GPXFile.new
|
56
57
|
all.each do |stop|
|
57
58
|
gpx.waypoints << GPX::Waypoint.new({name: stop.name, lat: stop.lat, lon: stop.lon, time: stop.updated_at})
|
58
|
-
end
|
59
|
+
end
|
59
60
|
gpx.to_s
|
60
61
|
end
|
61
62
|
end # class
|
62
63
|
|
63
64
|
|
64
65
|
# controllers/stops.rb
|
65
|
-
def index
|
66
|
+
def index
|
66
67
|
@stops = Stop.all
|
67
68
|
respond_to do |format|
|
68
69
|
format.html {render :index}
|
@@ -73,8 +74,8 @@ end
|
|
73
74
|
|
74
75
|
# Add this line to config/initializers/mime_types.rb
|
75
76
|
Mime::Type.register "application/gpx+xml", :gpx
|
76
|
-
|
77
|
-
|
77
|
+
|
78
|
+
|
78
79
|
# To get the xml file:
|
79
80
|
# http://localhost:3000/stops.gpx
|
80
81
|
```
|
@@ -88,13 +89,17 @@ This library was written to bridge the gap between my Garmin Geko
|
|
88
89
|
and my website, WalkingBoss.org (RIP). For that reason, it has always been more of a
|
89
90
|
work-in-progress than an attempt at full GPX compliance. The track side of the
|
90
91
|
library has seen much more use than the route/waypoint side, so if you're doing
|
91
|
-
something with routes or waypoints, you may need to tweak some things.
|
92
|
+
something with routes or waypoints, you may need to tweak some things.
|
92
93
|
|
93
94
|
Since this code uses XML to read an entire GPX file into memory, it is not
|
94
95
|
the fastest possible solution for working with GPX data, especially if you are
|
95
|
-
working with tracks from several days or weeks.
|
96
|
+
working with tracks from several days or weeks.
|
96
97
|
|
97
98
|
Finally, it should be noted that none of the distance/speed calculation or
|
98
99
|
crop/delete code has been tested under International Date Line-crossing
|
99
100
|
conditions. That particular part of the code will likely be unreliable if
|
100
101
|
you're zig-zagging across 180 degrees longitude routinely.
|
102
|
+
|
103
|
+
## License
|
104
|
+
|
105
|
+
MIT
|
data/gpx.gemspec
CHANGED
@@ -11,6 +11,8 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = %q{A basic API for reading and writing GPX files.}
|
12
12
|
s.description = %q{A basic API for reading and writing GPX files.}
|
13
13
|
|
14
|
+
s.required_ruby_version = '~>2.1'
|
15
|
+
|
14
16
|
s.files = `git ls-files`.split($/)
|
15
17
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
16
18
|
s.require_paths = ["lib"]
|
@@ -18,7 +20,7 @@ Gem::Specification.new do |s|
|
|
18
20
|
|
19
21
|
s.homepage = "http://www.github.com/dougfales/gpx"
|
20
22
|
s.add_dependency 'rake'
|
21
|
-
s.add_dependency 'nokogiri'
|
23
|
+
s.add_dependency 'nokogiri', '~>1.7'
|
22
24
|
s.add_development_dependency 'bundler'
|
23
25
|
s.add_development_dependency 'minitest'
|
24
26
|
end
|
data/lib/gpx/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gpx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume Dott
|
@@ -30,16 +30,16 @@ dependencies:
|
|
30
30
|
name: nokogiri
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- - "
|
33
|
+
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
35
|
+
version: '1.7'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- - "
|
40
|
+
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '1.7'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: bundler
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,9 +129,9 @@ require_paths:
|
|
129
129
|
- lib
|
130
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
|
-
- - "
|
132
|
+
- - "~>"
|
133
133
|
- !ruby/object:Gem::Version
|
134
|
-
version: '
|
134
|
+
version: '2.1'
|
135
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - ">="
|