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
GeoLocationAnchor and MKTileOverlay
Search
Tachibana Kaoru
June 22, 2022
Technology
400
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GeoLocationAnchor and MKTileOverlay
Tachibana Kaoru
June 22, 2022
More Decks by Tachibana Kaoru
See All by Tachibana Kaoru
Custom Group Activities
toyship
3
1.5k
Synchronized iPhones, Again!
toyship
2
1.7k
ARKit4.pdf
toyship
1
2.3k
Custom Gesture Recognizer on iOS
toyship
3
1.5k
HEVC Video with Alpha Channel
toyship
1
1.3k
RealityKit & Reality Composer
toyship
3
690
ARKit3
toyship
4
7.6k
UIViewPropertyAnimator and Easing
toyship
2
1.2k
Synchronized iPhones!
toyship
3
5k
Other Decks in Technology
See All in Technology
シンガポールで登壇してきます
yama3133
0
110
プロダクトだけじゃない、社内プロセスにおける自動化・省力化ノススメ
kakehashi
PRO
1
3.6k
Road to SRE NEXTの今までとこれから
hiroyaonoe
0
310
非定型なドキュメントを効率よくリファクタする 〜えぇ!?仕様書27本の移行が1日で終わったって!?〜
subroh0508
1
300
ruby.wasmとPicoRuby.wasmに対応した仮想DOMライブラリを作ってる話 #kaigieffect_kaigi
sue445
PRO
0
140
クラウド上のデータ復旧で見落としがちな制約: 医療系 SaaS の BCP 設計から得た教訓
kakehashi
PRO
0
3.4k
アカウントが増えてからでは遅い? ~ マルチアカウント統制の勘所 ~
kenichinakamura
0
220
SRE本の知られざる名シーン / The Hidden Gems of Google SRE Book
nari_ex
1
370
環境凍結という Toil を倒す -セルフサービス型 Ephemeral テスト環境の 設計と実践
shirouz
1
2.3k
Claude Code 珍プレー好プレー
shinyasaita
0
320
kintone の AI コワーカーを、 Anthropic にエージェントを"ホストさせて"作った話 #devkinmeetup
sugimomoto
0
100
なぜ私たちのSREプラクティスはなかなか機能しないのか 〜システムより先に組織を見る〜 / Why our SRE practices aren't really working
vtryo
3
3.6k
Featured
See All Featured
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
170
Building Applications with DynamoDB
mza
96
7.1k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Designing Experiences People Love
moore
143
24k
Agile that works and the tools we love
rasmusluckow
331
22k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.6k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
330
A Modern Web Designer's Workflow
chriscoyier
698
190k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
410
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
180
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
610
Transcript
GeoLocationAnchor and MKTileOverlay @TachibanaKaoru 2022/6/22 #potatotips 78
About Me @TachibanaKaoru Freelance iOS Engineer
What's new ARKit 6 4K Video Mode RoomPlan Location Anchor
RoomPlan ެࣜαϯϓϧίʔυ͋Γ
GeoLocation (AR Anchor) Introduced 2020 (ARKit 4) ൃදॳ͑ͨॴ αϯϑϥϯγείɺγΧΰɺϚΠΞϛɺχϡʔ ϤʔΫɺϩαϯθϧεͷΈɻ
ରҬΛ૿͢༧ఆͱ͍͍ͳ͕ΒɺʢCovid19ͷӨڹ͋Γʣͳ͔ ͳ͔૿͑·ͤΜͰͨ͠ɻ
AR Anchor Available Place WWDC 2022Ͱɺେ෯ʹରҬΛ֦େ͠ɺͬͱຊʹରԠҬ͕ ͖·ͨ͠ɻ Ԭɺౡɺେࡕɺژɺ໊ݹɺԣɺ౦ژ
AR Anchorͱ ҐஔʢҢ/ܦʣΛࢦఆͯ͠ΞϯΧʔΛ͓͘͜ͱ͕ Ͱ͖Δ ࣮ࡍͷݐͷ3DใͱɺΧϝϥը૾͔Βੳͨ͠3D ใͱɺͷGPSใΛΈ߹ΘͤͨΈ ඇৗʹਖ਼֬ͳҐஔଌఆ͕Մೳ ARҐஔܥήʔϜɺಓҊͳͲ͕؆୯ʹ࣮Մೳ
GeoLocation : check availability var targetLocation = CLLocationCoordinate2D() targetLocation.latitude =
lat targetLocation.longitude = long ARGeoTrackingConfiguration.checkAvailability( at: targetLocation, completionHandler: { (available, error) in // check available })
GeoLocation : check availability available ͕ trueͷ߹ʹ༻Մೳɻ available ͕ falseͷ߹ʹ༻ෆՄೳ͕ͩɺΤϥʔίʔυͰཧ༝Λ֬ೝ
͢Δ͜ͱ Error Code = 201 "Geo tracking is not available at this location." Error Code = 501 "Request failed." ʢϦΫΤετස͕ߴ͍ͱൃੜʣ
zoom 10 ௐࠪ : 2022/6/22 ௐࠪϙΠϯτɿ֤άϦουͷதԝ Latitude : 34.710809-37.050435 Longitude:
137.726092-140.887614
zoom 11 ௐࠪ : 2022/6/22 ௐࠪϙΠϯτɿ֤άϦουͷதԝ Latitude : 34.710809-37.050435 Longitude:
137.726092-140.887614
zoom 12 ௐࠪ : 2022/6/22 ௐࠪϙΠϯτɿ֤άϦουͷதԝ Latitude : 34.710809-37.050435 Longitude:
137.726092-140.887614
Available Place in Kanto Area ͬ͘͟Γݍԝಓɾࠃಓ468ͷଆͷࢢ֗ https://ja.wikipedia.org/wiki/टݍதԝ࿈བྷࣗಈंಓ
MKTileOverlay ~iOS 7.0 MKMapViewʹใΛΦʔόʔϨΠͰ දࣔ͢Δ͜ͱ͕Ͱ͖Δɻ
MKTileOverlay TileʹରԠͨ͠ใGoogle MapࠃཧӃͳͲ͔Βఏڙ͞Ε͍ͯ Δɻ MKTileOverlayʹɺTileରԠͨ͠API pathΛ͚ͩ͢ͰλΠϧΛදࣔ͢Δ͜ ͱՄೳ ྫɿࠃཧӃʢ୶৭ਤʣ https://cyberjapandata.gsi.go.jp/xyz/pale/{z}/{x}/{y}.png
λΠϧͱʁ ਤΛ zoom level ʹԠׂͯ͡͠ɺͦΕΛඞཁʹԠͯ͡৴ɾར༻͢Δɻ zoom level 0 -> 1
tile zoom level 1 -> 4 tiles zoom level 2 -> 16 tiles ... zoom level 10 -> 1048576 tiles zoom level n -> (2^n)^2
Tile Position ٿ্ͷಛఆͷ࠲ඪ͕ɺͲͷλΠϧʹҐஔ͢Δͷ͔ longitude = 135.0 latitude = 35.0
Longitude to x ܦͰTileͷx͕ܾ·Δ zoom level 2 -> 16 tiles
longitude = 135.0 ܦ0Λج४ͱ͠ɺٿ໘Λ 8ׂ͢Δ 0 long = 0 1 2 3 4 5 6 7 long = 135 ͔ΒΈͨٿ
Latitude to y ҢͰTileͷy͕ܾ·Δ zoom level 2 -> 16 tiles
latitude = 35.0 ۃΛج४ͱ͠ɺٿ໘Λ8 ׂ͢Δ 5 1 2 3 4 0 6 7 lat = 35 ԣ͔ΒΈͨٿ
let res = initialResolution / pow(2,zoom) let originShift = 2
* Double.pi * 6378137 / 2.0 var my = log( tan((90 + lat) * Double.pi / 360.0 )) / (Double.pi / 180.0) let py = (my + self.originShift) / res let tms_y = Int( ceil( py / Double(self.tileSize) ) - 1 ) let google_y = Int(pow(2, zoom) - 1 ) - tms_y ignore y = Rln(tan( π 4 + ϕ 2 )) 85.1°
Reference ࠃཧӃɹཧӃλΠϧʹ͍ͭͯ https://maps.gsi.go.jp/development/siyou.html ਤӨ๏ֶशͷͨΊͷਤը૾ૉࡐू https://user.numazu-ct.ac.jp/~tsato/tsato/graphics/map_projection/ άʔάϧϚοϓͷλΠϧ https://maptiler.jp/google-maps-coordinates-tile-bounds-projection/