Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
PostGis and Ruby
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
AndyDangerous
November 19, 2015
Technology
68
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PostGis and Ruby
A lightning talk on using PostGis in a Ruby stack.
AndyDangerous
November 19, 2015
Other Decks in Technology
See All in Technology
ソフトウェア ファクトリー - 再現性のあるソフトウェアの工場づくり / Software factory
iktakahiro
6
4.9k
Temporal 最高!でも改めて「日付」について調べたら人類の負債すぎる件
riyaamemiya
0
140
オントロジーって 結局なにもの? AI エージェントに「意味」を渡す知識設計の話
greenmidori
0
180
Claude の新機能を、 出た日に触って社内に届けるまで
rfdnxbro
1
170
Classmethod Company Deck
satoshi7
1
680
AIにシークレットを見せない、WSL2で安全な開発環境
yazm
0
300
エンタメ企業のM&Aを支えるデータ基盤 ― 統合から店舗のリアルタイム分析まで / Data Engineering Summit 2026
genda
0
170
OptunaHub: ブラックボックス最適化のためのプラットフォーム
pfn
PRO
0
140
AI駆動開発の時代になったのでトヨタ生産方式から見直す
terurou
7
6k
AIカンパニーへの転換を支えた、エンジニアの仕事の再定義
kworkdev
PRO
2
1.2k
re:Invent初参加で変わったこと、2回目にやってみたいこと(JAWS-UG彩の国埼玉 #12)
mhrtech
2
220
[JAWS-UG彩の国埼玉#12]そろそろ準備する?re:Invent2026をやさしく解説 / reinvent2026-sainokuni
sh_fk2
1
340
Featured
See All Featured
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
870
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
600
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
Building Adaptive Systems
keathley
44
3.2k
Mobile First: as difficult as doing things right
swwweet
225
10k
Designing Experiences People Love
moore
143
24k
sira's awesome portfolio website redesign presentation
elsirapls
0
450
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
320
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
530
Transcript
PostGIS and Ruby Andy Mention @amention
The Problem • Healthcare Providers • Participation • Location
The Stack • PostGIS (duh.) • Ruby • Grape API
• ActiveRecord
The Solution • Database table/view optimization • JSONB • Basic
spatial functionality • Compose query using Ruby
Code: where scope :by_language, lambda { |language| where(language: language) }
Code: where (jsonb) scope :by_language, lambda { |language| where("languages ?|
array['#{language}']") }
MOAR Code scope :participating, lambda { |doc_groups| groups = “‘#{doc_groups.join("','")}'"
where( "doctor_group ?| array[#{groups}] OR hospital_group ?| array[#{groups}]” ) } scope :awesome_doctors, lambda { select( "(CASE WHEN doctor_rating ?| array['awesome'] THEN 1 ELSE 2 END) as awesome” ).order("awesome") }
Do you even PostGIS? scope :within, lambda { |lat, lng,
radius| select( "ST_DWithin( the_geom, ST_GeomFromText('POINT(#{lng} #{lat})', 4326)::geography, #{radius})") }
None