Class: BlacklightMaps::GeojsonExport
- Inherits:
-
Object
- Object
- BlacklightMaps::GeojsonExport
- Includes:
- BlacklightMaps
- Defined in:
- lib/blacklight/maps/export.rb
Overview
This class provides the ability to export a response document to GeoJSON. The export is formated as a GeoJSON FeatureCollection, where the features consist of an array of Point features. For more on the GeoJSON specification see geojson.org/geojson-spec.html.
Instance Method Summary collapse
-
#initialize(controller, action, response_docs, options = {}) ⇒ GeojsonExport
constructor
A new instance of GeojsonExport.
-
#to_geojson ⇒ Object
builds the GeoJSON FeatureCollection.
Constructor Details
#initialize(controller, action, response_docs, options = {}) ⇒ GeojsonExport
Returns a new instance of GeojsonExport.
18 19 20 21 22 23 24 |
# File 'lib/blacklight/maps/export.rb', line 18 def initialize(controller, action, response_docs, = {}) @controller = controller @action = action @response_docs = response_docs @options = @features = [] end |
Instance Method Details
#to_geojson ⇒ Object
builds the GeoJSON FeatureCollection
27 28 29 |
# File 'lib/blacklight/maps/export.rb', line 27 def to_geojson { type: 'FeatureCollection', features: build_geojson_features }.to_json end |