Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 1.06 KB

index.markdown

File metadata and controls

41 lines (32 loc) · 1.06 KB
title
Support for geo and databases in Ruby and Rails

Support for geo and databases in Ruby and Rails

require "open-uri"
require "json"
require "rgeo"
require "rgeo-geojson"

my_lat, my_lng = [45, 5]
my_position = RGeo::Cartesian.
              factory.
              point(my_lng, my_lat)

geojson = URI.
    	  open("https://git.io/rhone-alpes.geojson").
    	  read
rhone_alpes = RGeo::GeoJSON.decode(geojson).geometry

if rhone_alpes.contains?(my_position)
  puts "Let's ski ⛷"
end

Resources

Credits

Thanks to @dazuma, author of RGeo. And to every contributors of the various projects.