diff --git a/lib/geo_ruby/gpx.rb b/lib/geo_ruby/gpx.rb index 10a1a26..71649b1 100644 --- a/lib/geo_ruby/gpx.rb +++ b/lib/geo_ruby/gpx.rb @@ -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]])]) end # Return GPX Envelope