Module: Underpass::GeoJSON
- Defined in:
- lib/underpass/geo_json.rb
Overview
Encodes Feature arrays as GeoJSON FeatureCollections.
Class Method Summary collapse
-
.encode(features) ⇒ Hash
Encodes an array of features as a GeoJSON FeatureCollection hash.
Class Method Details
.encode(features) ⇒ Hash
Encodes an array of features as a GeoJSON FeatureCollection hash.
16 17 18 19 20 21 |
# File 'lib/underpass/geo_json.rb', line 16 def self.encode(features) geo_features = features.map do |f| RGeo::GeoJSON::Feature.new(f.geometry, f.id, f.properties) end RGeo::GeoJSON.encode(RGeo::GeoJSON::FeatureCollection.new(geo_features)) end |