Skip to content

Commit

Permalink
Merge 56a03f2 into f9e39ca
Browse files Browse the repository at this point in the history
  • Loading branch information
leoroos committed May 12, 2015
2 parents f9e39ca + 56a03f2 commit 6bbc11d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/geo_ruby/gpx.rb
Expand Up @@ -73,7 +73,7 @@ def as_line_string
# If the GPX isn't closed, a line from the first
# to the last point will be created to close it.
def as_polygon
GeoRuby::SimpleFeatures::Polygon.from_points([@points[0] == @points[-1] ? @points : @points.push(@points[0].clone)])
GeoRuby::SimpleFeatures::Polygon.from_points([@points[0] == @points[-1] ? @points : (@points + [@points[0].clone])])
end

# Return GPX Envelope
Expand Down
5 changes: 5 additions & 0 deletions spec/geo_ruby/gpx_spec.rb
Expand Up @@ -34,6 +34,11 @@
expect(@gpxfile[0].y).to be_within(0.0001).of(48.731813)
end

it 'should point last record to last waypoint' do
expect(@gpxfile[-1].x).to be_within(0.0001).of(9.09436)
expect(@gpxfile[-1].y).to be_within(0.0001).of(48.731805)
end

it 'should read Z and M' do
expect(@gpxfile[0].z).to eql(468.0)
expect(@gpxfile[0].m).to eql('2008-09-07T17:36:57Z')
Expand Down

0 comments on commit 6bbc11d

Please sign in to comment.