gpx_kml 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c23ca7cf7f9d6dc903b41e82036593e7f9bb40b1ae5b17ecfd5faf39e2ca4bff
4
- data.tar.gz: 01b06257fc564b886843e9127f3fce7a37106b49e045342aa1c318dd1c2169f0
3
+ metadata.gz: 4e4f90ca7411226710707068d7b42b5d5bb9502b7431c842ec28611854e56487
4
+ data.tar.gz: 9926bc276fa356b3af9697a88e5b10c84cb421e4ef786268c1121ffb8cc8a536
5
5
  SHA512:
6
- metadata.gz: b185abea99664b9e60595dfa2782e9a712d3e3ce994e15daaa6c02dfc91ddaa478cc6e18b51b92a4aeacdd398336f2ba0ea7bfe3c8a0e4c5962939c0e83ad9c8
7
- data.tar.gz: 2089d40444b18ec20b049c24a5df3f728bfaae7f4be81750f993264c818bf9920acd926a8be5c38de903c26bd3ab669a7c3db940000a30a74eca6ceebabdde3b
6
+ metadata.gz: 58cc3fc0313d1e898ea57f4969e10618ebe6a0745b98933aa5e614ae18c49da3dae8c292613ec642b673a0f39fc3eb8bd9bdf72713a2d0072acc529567b8205f
7
+ data.tar.gz: 2b6e8dd1db1191146bcd25e467536bd5eb750a2739e3bc3912b2979339d05f4d15186b948d64b471f33727238e6efdfe2dded853f76c9203cfb9b61c6744a03b
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  /.idea/
10
+ /coverage/
10
11
 
11
12
  # rspec failure tracking
12
13
  .rspec_status
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
1
  ### V 0.1.x
2
+ - v 0.1.4:
3
+ - fixed kml files generation
4
+ - fixed bug that swapped latitude and longitude in certain conversions from gpx to kml
5
+ - added code coverage for development env
2
6
  - v 0.1.3:
3
7
  - changed usage & updated/fixed minor parts in documentation (README.md)
4
8
  - added preconverted files and missing tests
data/Gemfile.lock CHANGED
@@ -1,17 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gpx_kml (0.1.3)
4
+ gpx_kml (0.1.4)
5
5
  nokogiri (~> 1.12.0)
6
6
  rake (~> 12.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- diff-lcs (1.4.4)
12
- mini_portile2 (2.6.1)
13
- nokogiri (1.12.5)
14
- mini_portile2 (~> 2.6.1)
11
+ diff-lcs (1.5.0)
12
+ docile (1.4.0)
13
+ nokogiri (1.12.5-x86_64-linux)
15
14
  racc (~> 1.4)
16
15
  racc (1.6.0)
17
16
  rake (12.3.3)
@@ -21,13 +20,19 @@ GEM
21
20
  rspec-mocks (~> 3.10.0)
22
21
  rspec-core (3.10.1)
23
22
  rspec-support (~> 3.10.0)
24
- rspec-expectations (3.10.1)
23
+ rspec-expectations (3.10.2)
25
24
  diff-lcs (>= 1.2.0, < 2.0)
26
25
  rspec-support (~> 3.10.0)
27
26
  rspec-mocks (3.10.2)
28
27
  diff-lcs (>= 1.2.0, < 2.0)
29
28
  rspec-support (~> 3.10.0)
30
- rspec-support (3.10.2)
29
+ rspec-support (3.10.3)
30
+ simplecov (0.21.2)
31
+ docile (~> 1.1)
32
+ simplecov-html (~> 0.11)
33
+ simplecov_json_formatter (~> 0.1)
34
+ simplecov-html (0.12.3)
35
+ simplecov_json_formatter (0.1.3)
31
36
 
32
37
  PLATFORMS
33
38
  ruby
@@ -35,6 +40,7 @@ PLATFORMS
35
40
  DEPENDENCIES
36
41
  gpx_kml!
37
42
  rspec (~> 3.0)
43
+ simplecov (~> 0.21.0)
38
44
 
39
45
  BUNDLED WITH
40
- 2.1.4
46
+ 2.2.22
data/LICENSE.md ADDED
@@ -0,0 +1,157 @@
1
+ ### GNU LESSER GENERAL PUBLIC LICENSE
2
+
3
+ Version 3, 29 June 2007
4
+
5
+ Copyright (C) 2007 Free Software Foundation, Inc.
6
+ <https://fsf.org/>
7
+
8
+ Everyone is permitted to copy and distribute verbatim copies of this
9
+ license document, but changing it is not allowed.
10
+
11
+ This version of the GNU Lesser General Public License incorporates the
12
+ terms and conditions of version 3 of the GNU General Public License,
13
+ supplemented by the additional permissions listed below.
14
+
15
+ #### 0. Additional Definitions.
16
+
17
+ As used herein, "this License" refers to version 3 of the GNU Lesser
18
+ General Public License, and the "GNU GPL" refers to version 3 of the
19
+ GNU General Public License.
20
+
21
+ "The Library" refers to a covered work governed by this License, other
22
+ than an Application or a Combined Work as defined below.
23
+
24
+ An "Application" is any work that makes use of an interface provided
25
+ by the Library, but which is not otherwise based on the Library.
26
+ Defining a subclass of a class defined by the Library is deemed a mode
27
+ of using an interface provided by the Library.
28
+
29
+ A "Combined Work" is a work produced by combining or linking an
30
+ Application with the Library. The particular version of the Library
31
+ with which the Combined Work was made is also called the "Linked
32
+ Version".
33
+
34
+ The "Minimal Corresponding Source" for a Combined Work means the
35
+ Corresponding Source for the Combined Work, excluding any source code
36
+ for portions of the Combined Work that, considered in isolation, are
37
+ based on the Application, and not on the Linked Version.
38
+
39
+ The "Corresponding Application Code" for a Combined Work means the
40
+ object code and/or source code for the Application, including any data
41
+ and utility programs needed for reproducing the Combined Work from the
42
+ Application, but excluding the System Libraries of the Combined Work.
43
+
44
+ #### 1. Exception to Section 3 of the GNU GPL.
45
+
46
+ You may convey a covered work under sections 3 and 4 of this License
47
+ without being bound by section 3 of the GNU GPL.
48
+
49
+ #### 2. Conveying Modified Versions.
50
+
51
+ If you modify a copy of the Library, and, in your modifications, a
52
+ facility refers to a function or data to be supplied by an Application
53
+ that uses the facility (other than as an argument passed when the
54
+ facility is invoked), then you may convey a copy of the modified
55
+ version:
56
+
57
+ - a) under this License, provided that you make a good faith effort
58
+ to ensure that, in the event an Application does not supply the
59
+ function or data, the facility still operates, and performs
60
+ whatever part of its purpose remains meaningful, or
61
+ - b) under the GNU GPL, with none of the additional permissions of
62
+ this License applicable to that copy.
63
+
64
+ #### 3. Object Code Incorporating Material from Library Header Files.
65
+
66
+ The object code form of an Application may incorporate material from a
67
+ header file that is part of the Library. You may convey such object
68
+ code under terms of your choice, provided that, if the incorporated
69
+ material is not limited to numerical parameters, data structure
70
+ layouts and accessors, or small macros, inline functions and templates
71
+ (ten or fewer lines in length), you do both of the following:
72
+
73
+ - a) Give prominent notice with each copy of the object code that
74
+ the Library is used in it and that the Library and its use are
75
+ covered by this License.
76
+ - b) Accompany the object code with a copy of the GNU GPL and this
77
+ license document.
78
+
79
+ #### 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that, taken
82
+ together, effectively do not restrict modification of the portions of
83
+ the Library contained in the Combined Work and reverse engineering for
84
+ debugging such modifications, if you also do each of the following:
85
+
86
+ - a) Give prominent notice with each copy of the Combined Work that
87
+ the Library is used in it and that the Library and its use are
88
+ covered by this License.
89
+ - b) Accompany the Combined Work with a copy of the GNU GPL and this
90
+ license document.
91
+ - c) For a Combined Work that displays copyright notices during
92
+ execution, include the copyright notice for the Library among
93
+ these notices, as well as a reference directing the user to the
94
+ copies of the GNU GPL and this license document.
95
+ - d) Do one of the following:
96
+ - 0) Convey the Minimal Corresponding Source under the terms of
97
+ this License, and the Corresponding Application Code in a form
98
+ suitable for, and under terms that permit, the user to
99
+ recombine or relink the Application with a modified version of
100
+ the Linked Version to produce a modified Combined Work, in the
101
+ manner specified by section 6 of the GNU GPL for conveying
102
+ Corresponding Source.
103
+ - 1) Use a suitable shared library mechanism for linking with
104
+ the Library. A suitable mechanism is one that (a) uses at run
105
+ time a copy of the Library already present on the user's
106
+ computer system, and (b) will operate properly with a modified
107
+ version of the Library that is interface-compatible with the
108
+ Linked Version.
109
+ - e) Provide Installation Information, but only if you would
110
+ otherwise be required to provide such information under section 6
111
+ of the GNU GPL, and only to the extent that such information is
112
+ necessary to install and execute a modified version of the
113
+ Combined Work produced by recombining or relinking the Application
114
+ with a modified version of the Linked Version. (If you use option
115
+ 4d0, the Installation Information must accompany the Minimal
116
+ Corresponding Source and Corresponding Application Code. If you
117
+ use option 4d1, you must provide the Installation Information in
118
+ the manner specified by section 6 of the GNU GPL for conveying
119
+ Corresponding Source.)
120
+
121
+ #### 5. Combined Libraries.
122
+
123
+ You may place library facilities that are a work based on the Library
124
+ side by side in a single library together with other library
125
+ facilities that are not Applications and are not covered by this
126
+ License, and convey such a combined library under terms of your
127
+ choice, if you do both of the following:
128
+
129
+ - a) Accompany the combined library with a copy of the same work
130
+ based on the Library, uncombined with any other library
131
+ facilities, conveyed under the terms of this License.
132
+ - b) Give prominent notice with the combined library that part of it
133
+ is a work based on the Library, and explaining where to find the
134
+ accompanying uncombined form of the same work.
135
+
136
+ #### 6. Revised Versions of the GNU Lesser General Public License.
137
+
138
+ The Free Software Foundation may publish revised and/or new versions
139
+ of the GNU Lesser General Public License from time to time. Such new
140
+ versions will be similar in spirit to the present version, but may
141
+ differ in detail to address new problems or concerns.
142
+
143
+ Each version is given a distinguishing version number. If the Library
144
+ as you received it specifies that a certain numbered version of the
145
+ GNU Lesser General Public License "or any later version" applies to
146
+ it, you have the option of following the terms and conditions either
147
+ of that published version or of any later version published by the
148
+ Free Software Foundation. If the Library as you received it does not
149
+ specify a version number of the GNU Lesser General Public License, you
150
+ may choose any version of the GNU Lesser General Public License ever
151
+ published by the Free Software Foundation.
152
+
153
+ If the Library as you received it specifies that a proxy can decide
154
+ whether future versions of the GNU Lesser General Public License shall
155
+ apply, that proxy's public statement of acceptance of any version is
156
+ permanent authorization for you to choose that version for the
157
+ Library.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # GpxKml
2
2
 
3
+ [![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](http://www.gnu.org/licenses/lgpl-3.0) [![Coverage: %](https://img.shields.io/badge/Code%20coverage-100%25-green.svg)](#coverage)
4
+
3
5
  This gem adds the capability to convert GPS Exchange Format (GPX) files to Keyhole Markup Language (KML) files and viceversa
4
6
 
5
7
  ## Before using
@@ -57,6 +59,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
57
59
 
58
60
  Bug reports and pull requests are welcome on GitHub at https://github.com/Engim-eu/gpx_kml. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/gpx_kml/blob/master/CODE_OF_CONDUCT.md).
59
61
 
62
+ ## Coverage
63
+
64
+ Coverage can be checked running `rake spec`. This command will generate the coverage files needed.
60
65
 
61
66
  ## Code of Conduct
62
67
 
data/gpx_kml.gemspec CHANGED
@@ -9,6 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.summary = 'Gem to convert .gpx into .kml and back'
10
10
  spec.description = 'This gem adds the capability to convert GPS Exchange Format (GPX) files to Keyhole Markup Language (KML) files and viceversa'
11
11
  spec.homepage = 'https://www.github.com/engim-eu/gpx_kml'
12
+ spec.licenses = ['LGNU']
12
13
  spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
13
14
 
14
15
  spec.metadata['allowed_push_host'] = "https://rubygems.org"
@@ -35,6 +36,9 @@ Gem::Specification.new do |spec|
35
36
  # Gem testing
36
37
  spec.add_development_dependency 'rspec', '~>3.0'
37
38
 
39
+ # Test coverage
40
+ spec.add_development_dependency 'simplecov', '~>0.21.0'
41
+
38
42
  # spec.add_development_dependency 'factory_bot', '~>6.2'
39
43
  # factory_bot isn't really used
40
44
  end
data/lib/converter.rb CHANGED
@@ -72,19 +72,21 @@ module CONVERTER
72
72
  def self.kml_routes(xml, gpx)
73
73
  if gpx.routes?
74
74
  gpx.routes.each do |r|
75
- xml.LinearRing do
76
- xml.extrude('0')
77
- xml.tassellate('0')
78
- xml.altitudeMode('clampToGroud')
79
- s = ''
80
- r.points.each do |p|
81
- s = if p.elevation.nil? || p.elevation.empty?
82
- s + "#{p.latitude},#{p.longitude} "
83
- else
84
- s + "#{p.latitude},#{p.longitude},#{p.elevation} "
85
- end
75
+ xml.Placemark do
76
+ xml.LinearRing do
77
+ xml.extrude('0')
78
+ xml.tassellate('0')
79
+ xml.altitudeMode('clampToGroud')
80
+ s = ''
81
+ r.points.each do |p|
82
+ s = if p.elevation.nil? || p.elevation.empty?
83
+ s + "#{p.longitude},#{p.latitude} "
84
+ else
85
+ s + "#{p.longitude},#{p.latitude},#{p.elevation} "
86
+ end
87
+ end
88
+ xml.coordinates(s[0..-2])
86
89
  end
87
- xml.coordinates(s[0..-2])
88
90
  end
89
91
  end
90
92
  end
@@ -93,27 +95,29 @@ module CONVERTER
93
95
  def self.kml_tracks(xml, gpx)
94
96
  if gpx.tracks?
95
97
  gpx.tracks.each do |t|
96
- xml.LineString do
97
- xml.extrude('0')
98
- xml.tassellate('0')
99
- xml.altitudeMode('clampToGroud')
100
- s = ''
101
- points = []
102
- t.segments.each do |sg|
103
- sg.points.each do |p|
104
- points = points << p
98
+ xml.Placemark do
99
+ xml.LineString do
100
+ xml.extrude('0')
101
+ xml.tassellate('0')
102
+ xml.altitudeMode('clampToGroud')
103
+ s = ''
104
+ points = []
105
+ t.segments.each do |sg|
106
+ sg.points.each do |p|
107
+ points = points << p
108
+ end
105
109
  end
106
- end
107
- points.each do |p|
108
- next if p.nil?
110
+ points.each do |p|
111
+ next if p.nil?
109
112
 
110
- s = if p.elevation.nil? || p.elevation.empty?
111
- s + "#{p.latitude},#{p.longitude} "
112
- else
113
- s + "#{p.latitude},#{p.longitude},#{p.elevation} "
114
- end
113
+ s = if p.elevation.nil? || p.elevation.empty?
114
+ s + "#{p.longitude},#{p.latitude} "
115
+ else
116
+ s + "#{p.longitude},#{p.latitude},#{p.elevation} "
117
+ end
118
+ end
119
+ xml.coordinates(s[0..-2])
115
120
  end
116
- xml.coordinates(s[0..-2])
117
121
  end
118
122
  end
119
123
  end
@@ -126,9 +130,9 @@ module CONVERTER
126
130
  xml.extrude('0')
127
131
  xml.altitudeMode('clampToGroud')
128
132
  if p.elevation.nil? || p.elevation.empty?
129
- xml.coordinates("#{p.latitude},#{p.longitude}")
133
+ xml.coordinates("#{p.longitude},#{p.latitude}")
130
134
  else
131
- xml.coordinates("#{p.latitude},#{p.longitude},#{p.elevation}")
135
+ xml.coordinates("#{p.longitude},#{p.latitude},#{p.elevation}")
132
136
  end
133
137
  end
134
138
  end
@@ -16,8 +16,8 @@ module KML
16
16
 
17
17
  @father = father
18
18
  coord = coord.split(',')
19
- @latitude = coord[0]
20
- @longitude = coord[1]
19
+ @longitude = coord[0]
20
+ @latitude = coord[1]
21
21
  @elevation = coord[2] if coord.length == 3
22
22
  @node = node
23
23
  # Name is looked up in the ancestor of the node that compose this point
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GPXKML
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gpx_kml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Angelo Terzi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-29 00:00:00.000000000 Z
11
+ date: 2022-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.21.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.21.0
55
69
  description: This gem adds the capability to convert GPS Exchange Format (GPX) files
56
70
  to Keyhole Markup Language (KML) files and viceversa
57
71
  email:
@@ -67,6 +81,7 @@ files:
67
81
  - CODE_OF_CONDUCT.md
68
82
  - Gemfile
69
83
  - Gemfile.lock
84
+ - LICENSE.md
70
85
  - README.md
71
86
  - Rakefile
72
87
  - bin/console
@@ -90,7 +105,8 @@ files:
90
105
  - lib/gpx_kml/templates/wpt.gpx
91
106
  - lib/gpx_kml/version.rb
92
107
  homepage: https://www.github.com/engim-eu/gpx_kml
93
- licenses: []
108
+ licenses:
109
+ - LGNU
94
110
  metadata:
95
111
  allowed_push_host: https://rubygems.org
96
112
  homepage_uri: https://www.github.com/engim-eu/gpx_kml
@@ -111,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
127
  - !ruby/object:Gem::Version
112
128
  version: '0'
113
129
  requirements: []
114
- rubygems_version: 3.1.4
130
+ rubygems_version: 3.2.22
115
131
  signing_key:
116
132
  specification_version: 4
117
133
  summary: Gem to convert .gpx into .kml and back