lib/terraformer/feature.rb in terraformer-0.0.4 vs lib/terraformer/feature.rb in terraformer-0.0.6
- old
+ new
@@ -35,10 +35,14 @@
def great_circle_distance other
other = other.geometry if Feature === other
self.geometry.great_circle_distance other
end
+ def geojson_io
+ Terraformer.geojson_io self
+ end
+
end
class FeatureCollection < Primitive
attr_writer :features
@@ -51,11 +55,11 @@
end
def initialize *args
unless args.empty?
super *args do |arg|
- self.features = arg['features'].map {|f| Terraformer.parse f}
+ self.features = arg['features'].map {|f| Terraformer.parse f unless Primitive === f}
end
end
end
def features
@@ -74,9 +78,13 @@
}
end
def convex_hull
ConvexHull.for features.map(&:geometry).map(&:coordinates)
+ end
+
+ def geojson_io
+ Terraformer.geojson_io self
end
end
end