class Geoq::GeoJson

Public Instance Methods

as_geojson(feature = false) click to toggle source
# 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