Module: RGeo::GeoJSON::ConversionMethods
- Included in:
 - Feature, FeatureCollection
 
- Defined in:
 - lib/rgeo/geo_json/conversion_methods.rb
 
Overview
This module serves to provide handy methods when using GeoJSON. The methods provided eases the passage between entities and GeoJSON String/Hash.
Instance Method Summary collapse
- 
  
    
      #as_geojson  ⇒ Object 
    
    
      (also: #as_json)
    
  
  
  
  
  
  
  
  
  
    
Convert a geometry to a GeoJSON Hash.
 - 
  
    
      #to_geojson  ⇒ Object 
    
    
      (also: #to_json)
    
  
  
  
  
  
  
  
  
  
    
Convert a geometry to a GeoJSON String.
 
Instance Method Details
#as_geojson ⇒ Object Also known as: as_json
Convert a geometry to a GeoJSON Hash
      8 9 10  | 
    
      # File 'lib/rgeo/geo_json/conversion_methods.rb', line 8 def as_geojson GeoJSON.encode(self) end  | 
  
#to_geojson ⇒ Object Also known as: to_json
Convert a geometry to a GeoJSON String
      14 15 16  | 
    
      # File 'lib/rgeo/geo_json/conversion_methods.rb', line 14 def to_geojson ::MultiJson.dump(as_geojson) end  |