Class: Geoq::GeoJson
Instance Attribute Summary
Attributes inherited from Entity
Instance Method Summary collapse
Methods inherited from Entity
#gh_children, #gh_neighbors, #gh_string, #initialize, #to_geojson, #to_wkt
Constructor Details
This class inherits a constructor from Geoq::Entity
Instance Method Details
#as_geojson(feature = false) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/geoq/entity.rb', line 71 def as_geojson(feature = false) if feature if entity.is_a?(RGeo::GeoJSON::Feature) RGeo::GeoJSON.encode(entity) else {type: "Feature", properties: {}, geometry: RGeo::GeoJSON.encode(entity)} end else RGeo::GeoJSON.encode(entity) end end |