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
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
はじめてのWDM
miyukichi_ospf
1
140
穢れた技術選定について
watany
4
450
Claude Code公式skillで 自分の仕事を少しずつ手放そう!(Claude Code開発ノウハウ大公開スペシャル by クラスメソッド)
kaym
1
310
AIと共生する開発者プラットフォーム:バクラクのモノレポ×マイクロサービス基盤
sakajunquality
2
3.5k
AI時代のエンジニアキャリアについて今一度考える
sakamoto_582
2
1.5k
ruby.wasmとPicoRuby.wasmに対応した仮想DOMライブラリを作ってる話 #kaigieffect_kaigi
sue445
PRO
0
150
ローカルLLMとLINE Botの組み合わせ その3 / LINE DC Generative AI Meetup #8
you
PRO
0
130
“それは自分の仕事じゃない"を越えて行け
yuukiyo
0
210
Oracle Exadata Database Service on Cloud@Customer X11M (ExaDB-C@C) サービス概要
oracle4engineer
PRO
2
8.4k
ゴールデンパスは敷いただけでは道にならない ─ 企画部門のエンジニアが技術標準を事業価値に変えるまで
mhrtech
0
140
人を動かすのは時間ではなく、納得感 〜新任EMが入社3ヶ月、組織を2回変えた話〜
kakehashi
PRO
3
220
LLM/Agent評価:トップ営業の発言を「正解」にする 〜暗黙的正解による評価を営業資産に変える〜
takkuhiro
1
210
Featured
See All Featured
Speed Design
sergeychernyshev
33
1.9k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
870
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
420
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
260
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
44k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Bash Introduction
62gerente
615
220k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.1k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
360
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.4k
The SEO Collaboration Effect
kristinabergwall1
1
500
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։ൃʹؔΘͬͯΔօ༷ʂʂʂ
Ͳ͏ ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ