Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Groonga with MapKit
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
takatomo okitsu
November 29, 2013
Technology
1.2k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Groonga with MapKit
takatomo okitsu
November 29, 2013
More Decks by takatomo okitsu
See All by takatomo okitsu
XCode6 / iPhone6 / iOS8 デザイナーが知ってると 便利なTips
okitsutakatomo
34
13k
笑顔があつまるインスタレーション Smile:D #potatotips7
okitsutakatomo
0
4.1k
デブサミ2014【14-C-4】 DeNAにおけるゲーム以外の新規事業の立ち上げ方
okitsutakatomo
37
13k
Other Decks in Technology
See All in Technology
AI時代における最適なQA組織の作り方
ymty
3
490
「ちゃんとやっている」は独りよがりだった ― 不安に寄り添うインシデント対応へ / Towards incident response that addresses anxieties
chmikata
1
4.3k
デジタル・デザイン:次の50年を描く「進化する青写真」
y150saya
0
840
product engineering with qa
nealle
0
150
SREとQA 二人三脚で進めるSLO運用/sre-qa-slo
sugitak
0
120
そのタスクオンスケですか?
poropinai1966
0
150
ZOZOTOWNの進化と信頼性を両立する負荷試験
zozotech
PRO
1
150
クラウド上のデータ復旧で見落としがちな制約: 医療系 SaaS の BCP 設計から得た教訓
kakehashi
PRO
0
3k
次世代ランサムウェア対策の考察 / 20260704 Mitsutoshi Matsuo
shift_evolve
PRO
5
1.7k
ローカルLLMとLINE Botの組み合わせ その3 / LINE DC Generative AI Meetup #8
you
PRO
0
130
SRE本の知られざる名シーン / The Hidden Gems of Google SRE Book
nari_ex
1
260
NDIAS CTF 2026 問題解説会資料
bata_24
0
180
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
44k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
180
Six Lessons from altMBA
skipperchong
29
4.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
490
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
610
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
Technical Leadership for Architectural Decision Making
baasie
3
440
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.9k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
180
Transcript
GroongaͱMapKit גࣜձࣾσΟʔɾΤψɾΤʔ ΤϯλʔςΠϝϯτࣄۀຊ෦ ԭ وஐ
ࣗݾհ • ԭوஐ @okitsu • 201110݄ೖࣾɻ • ΤϯλʔςΠϝϯτࣄۀຊ෦ॴଐ • ࠷ۙͷϝΠϯiOS։ൃɻαʔόαΠυͪΐ͍ͪ
ΐ͍ɻ https://www.facebook.com/okitsu.takatomo
• Mobage • Comm: Free calls, texts and fun! •
Baseball Staduim LIVE • Peko: Play to be Paid! ؔΘͬͨϓϩμΫτ Now
ΤϯλʔςΠϝϯτࣄۀຊ෦ͱʁ • ඇήʔϜͷ৽نࣄۀ։ൃΛ୲͢Δ෦ॺ • େখ༷ʑͳαʔϏεɾϓϩμΫτΛ։ൃதɻ • ࠓ̓ຊ΄ͲϦϦʔεࡁΈɻ·Ͱ10ຊҎ্ ? ? ?
ࠓճղઆ͢ΔϓϩμΫτ
※ຊͰϦϦʔεͯ͠·ͤΜ
None
Ґஔใʹؔ͢Δ ओͳϢʔεέʔε • ද͍ࣔͯ͠ΔMapͷൣғʹ͍ΔϢʔβΛݕࡧ → Map্ʹϐϯΛཱͯΔ • ͕͍ࣗΔҐஔ͔Β͍ۙॱʹݕࡧ GroongaͰ࣮ݱ
Ґஔใͷߋ৽ Groonga MySQL JSONRPC Server JSONRPC load (over http) response
latitude / longtitude save iOSͷLocationAPIͰ Ңܦऔಘ
Ґஔใͷߋ৽ • MySQLʹҢ/ܦΛJSONܗࣜͰ֨ೲ {"lat":"35.440098", "lon":"139.627821"} • ͦͷޙɺGroongaʹloadίϚϯυͰอଘ (httpܦ༝) Ϛελʔσʔλ͋͘·ͰMySQLͰཧ Groongaͷσʔλݕࡧઐ༻
load --table Users [ { "_key": "123", "location": "35.440098x139.627821", } ] ※_keyϢʔβID
※ಛఆͷൣғʹ͍ΔϢʔβͷݕࡧ Groonga MySQL JSONRPC Server JSONRPC ϢʔβҰཡ ӈ্ʢ౦ʣͷlatitude / longtitude
sql ࠨԼʢೆʣͷlatitude / longtitude + geo_in_circleͰϑΟϧλ Ґஔใͷݕࡧ ϢʔβҰཡ ϢʔβҰཡ select (over http)
iOSʹ͓͚Δൣғͷಛఆํ๏ CGPoint northEast = CGPointMake( self.mapView.bounds.origin.x+self.mapView.bounds.size.width, self.mapView.bounds.origin.y ); CLLocationCoordinate2D convertNorthEast
= [self.mapView convertPoint:northEast toCoordinateFromView:self.mapView]; CGPoint southWest =CGPointMake( self.mapView.bounds.origin.x, self.mapView.bounds.origin.y+self.mapView.bounds.size.height ); CLLocationCoordinate2D convertSouthWest = [self.mapView convertPoint:southWest toCoordinateFromView:self.mapview];
αʔόαΠυͰ2ͷ࠲ඪΛԁʹม αʔόαΠυͰɺ2ͷ࠲ඪ Λԁʹม͔ͯ͠Βɺ geo_in_circleؔΛར༻ͯ͠ Groongaʹ͍߹Θͤ use Geo::Direction::Distance
ͳͥΘ͟Θ͟ԁࢦఆʹม͍ͯ͠Δͷ͔ʁ • Groongaʹgeo_in_rectangleͱ͍͏͕ؔ͋ΓɺͦΕΛϑΟϧλʔʹ͑ ɺΘ͟Θ͟2ͷ࠲ඪ͔Βԁʹมͯ͠ࢦఆ͢Δඞཁͳ͍ɻ • વɺ࠷ॳͦ͏ͬͯͨΜͰ͕͢ɾɾɾɾ ԿճͬͯೆٿͷϢʔβ͕ ώοτ͠ͳ͍ɻ ΦʔετϥϦΞͱ͔ೆถͷਓؒ શһࢮΜͩΜ͡Όͳ͍͔ʂ
ιʔεݟͨ negative coordinate is not implemented!!!
RedmineͰλεΫൃݟ
geo_in_rectangleؔΛ͏߹ʹ ͝ҙ͍ͩ͘͞ɻ ※ຊݶఆͱ͔ͩͱͨͿΜେৎ
ϑϦοΫͰMapΛ্ԼࠨӈʹҠಈ ͨ͠ΓɺεϫΠϓͰMapΛ֦େɾ ॖখͨ͠߹ɺ৽͍͠ൣғͰϢʔ βΛ࠶औಘ͠ͳ͍ͱ͍͚ͳ͍ MapΛϑϦοΫ/εϫΠϓͯ͠Ҡಈͨ͠߹ͷ ߋ৽ํ๏
- (void)mapView:(MKMapView*)mapView regionDidChangeAnimated:(BOOL)animated { [self performSelector:@selector(updateDisplayedRegionUsers) withObject:self afterDelay:2.0]; } -
(void)mapView:(MKMapView*)mapView regionWillChangeAnimated:(BOOL)animated { [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(updateDisplayedRegionUsers) object:nil]; } MapΛϑϦοΫ/εϫΠϓͯ͠Ҡಈͨ͠߹ͷ ߋ৽ํ๏ • Ґஔͷมߋ͕ߦΘΕ͔ͯΒɺ2ඵޙʹαʔό͔Β࠶औಘ͢Δɻ • 2ඵҎʹ࠶Ґஔͷมߋ͕ߦΘΕͨΒɺऔಘΛΩϟϯηϧ͢Δɻ
ͨ·ʹGoongaͷ selectͰίέΔ • GroongaͱͷΠϯλϑΣʔεɺAnyEvent::GroongaΛ͍͕ͬͯͨɺ ͨ·ʹselectͰίέͰ্ख͘ใ͕औಘͰ͖ͳ͍έʔε͕͋ͬͨɻ • ௐͨͱ͜ΖɺAnyEventΛͬͯඇಉظͰhttpଓ͍ͯ͠Δ͋ͨΓ͕ ո͔ͬͨͨ͠ΊɺfurlͰಉظతʹଓ͢ΔΑ͏ʹஔ͖͑ͨɻ → ઈ҆ఆʂ
※ݪҼಛఆʹࢸΒͣɺ͍͢·ͤΜɻɻ AnyEvent::Groonga Λར༻͢Δ߹͝ҙ͍ͩ͘͞ɻ
ඇಉظ→ಉظͩͱύϑΥʔϚϯε͕ ؾʹͳΔ → ϕϯνͱͬͨ API (※1) ϦΫΤετ ฏۉϨεϙϯε λΠϜ(s) εϧʔϓοτ
(ϦΫΤετ/s) updateLocation ʢҐஔใͷߋ৽ʣ 101892 0.358 s 550.3 searchUserByRegion ʢҐஔใͷݕࡧʣ 109224 0.380 s 449.7 ※1 JSONRPCαʔόͷAPI໊Ͱ͢ɻ͜ͷAPIͷதͰಉظతʹGroongaΛ͍ͨͨͯ·͢ɻ JSONRPCαʔό : 2 ʢϋʔυεϖοΫΕͨɻੴڮ͞Μʹ֬ೝ͠·͢ʣ JSONRPCαʔόworker : 200 Groongaαʔό : 2 ΫϥΠΞϯτଟॏ : ඵؒ200ϦΫΤετ ༨༟Ͱڐ༰ൣғ
ӡ༻ͷʢಛʹՄ༻ੑʣ Groonga-1 load Groonga-2 JSONRPC αʔό update location • GroongaϚϧνϚελߏɻߋ৽ͯ͢ͷGroonga
ʹରͯ͠ߦ͏ɻࢀরͲ͔͜Ұͭʹରͯ͠ߦ͏ɻ ৗʹ ಉ͡σʔλ ʹ͓ͯ͘͠ load
Groonga-1 Groonga-2 JSONRPC αʔό update location ✗ ͳΜ͔མͪͨ ো࣌Ͳ͏͢Δ͔ʁ load
load
खॱͦͷ1 Groonga-1 load Groonga-2 JSONRPC αʔό update location ✗ •
Groonga-2Λӡ༻͔Βൈ͍ͯɺGroonga-1ʹߋ৽ɾࢀর ΛدͤΔ ✗
खॱͦͷ2 Groonga-1 Groonga-2 JSONRPC αʔό update location • Groonga-2Λ෮چͤͯ͞࠶ೖɻͦͷࡍɺGroonga-2ͷ σʔλ͕ݹ͍Մೳੑ͕͋ΔͨΊɺࢀর͔Βͣ͢ɻ
ͨͩ͠ɺσʔλͷߋ৽ड͚͚Δɻ load load Selectμϝʂ loadOK!
खॱͦͷ3 Groonga-2 • Groonga-2Λӡ༻ͤͭͭ͞ɺMySQLͷϚελʔσʔλ ͱGroongaΛಉظͤ͞ΔεΫϦϓτΛྲྀͯ͠ɺσʔλ Λಉظͤ͞Δɻ εΫϦϓτͰ MySQLͷσʔλͱ ಉظͤ͞Δʂ MySQL
खॱͦͷ4 Groonga-1 Groonga-2 JSONRPC αʔό update location • σʔλͷಉظͷྃΛ֬ೝͯ͠ɺGroonga-2ʹର͢Δࢀ রΛ͢ɻdoneʂ
selectΛ ෮׆ʂ load load
ͦͷଞ
MapʹҰʹͨ͘͞ΜPinΛͨͯΔͱ ॏ͘ͳΔ͠͏͍͟
MapʹҰʹͨ͘͞ΜPinΛͨͯΔͱ ॏ͘ͳΔ͠͏͍͟ • ҰճͷݕࡧͰɺͨ͘͞ΜͷσʔλΛදࣔͯ͠͠·͏ͱ͏͍͟ɻ (લͷϖʔδͷΑ͏ʹͳΔʣ • ͳͷͰ1ճͷݕࡧͷϨεϙϯε25݅ఔʹ͓͍͑ͯ͞Δɻ • ্هͷߜΓࠐΉϩδοΫɺMap্ʹ͏·͘ࢄͤ͞ΒΕΔʢਅΜதʹूத͠ͳ ͍ʣΑ͏ʹ͍ͯ͠Δɻ
※શମͷώοτ͔݅Βɺ25ਓఔʹ͓͑͞ΒΕΔΑ͏ʹɺ_key(user_id)Λม Ͱׂͬͨ༨Γ͕5ͷϢʔβ͚ͩऔಘ͢Δͱ͔ɺͦ͏͍͏ΫΤϦΛ͍͛ͯΔɻ • MapΛ֦େ͍ͯ͘͜͠ͱͰɺରϢʔβ͕ঃʑʹߜΓ͜·Ε͍ͯ͘ͷͰɺ࠷ऴత ʹͯ͢ͷϢʔβ͕දࣔͰ͖ΔΑ͏ʹͳΔɻ • ͜ͷ͋ͨΓͬͱվળͰ͖Δ͔ͳɻ
iOSʹ͓͚ΔҐஔใͷऔಘํ๏ • ͍͜͜Ζ͍Ζਂ͍ΜͰ͕͢·ͨࠓ ʂ
ޚྱ • ͙ʹΌΒ͞Μʂ • ITج൫ ੴڮ͞Μʂ • mitz͞Μʂ@t_mitz • Yosaku
ToyamaʂʢPekoͷGroonga୲ʣ • Groonga։ൃʹؔΘͬͯΔօ༷ʂʂʂ
Ͳ͏ ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ