Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
GeoLocationAnchor and MKTileOverlay
Tachibana Kaoru
June 22, 2022
Technology
0
150
GeoLocationAnchor and MKTileOverlay
Tachibana Kaoru
June 22, 2022
Tweet
Share
More Decks by Tachibana Kaoru
See All by Tachibana Kaoru
Custom Group Activities
toyship
3
870
Synchronized iPhones, Again!
toyship
2
1k
ARKit4.pdf
toyship
1
1.7k
Custom Gesture Recognizer on iOS
toyship
3
940
HEVC Video with Alpha Channel
toyship
1
740
RealityKit & Reality Composer
toyship
3
330
ARKit3
toyship
5
6.5k
UIViewPropertyAnimator and Easing
toyship
2
690
Synchronized iPhones!
toyship
3
3.7k
Other Decks in Technology
See All in Technology
【NGK2023S】 ノードエディタ形式の画像処理ツール「Image-Processing-Node-Editor」
kazuhitotakahashi
0
200
ついに来る!TypeScript5.0の新機能
uhyo
16
8.7k
Cloudflare Workersで動くOG画像生成器
aiji42
1
440
アムロは成長しているのか AIから分析する
miyakemito
1
320
日本ディープラーニング協会主催 NeurIPS 2022 技術報告会講演資料
tdailab
0
910
FlexScan HD2452Wの 後継を探して
tring
0
180
Google Cloud Updates 2022/12/01-12/15
no24oka
1
150
LINE iOSエンジニアの日々 / LINE iOS Engineer Days
line_developers
PRO
1
130
OCI DevOps 概要 / OCI DevOps overview
oracle4engineer
PRO
0
470
データエンジニアを助けてくれるFivetranとSnowflakeの仕様&機能のご紹介
sagara
0
420
日経電子版だけじゃない! 日経の新規Webメディアの開発 - NIKKEI Tech Talk #3
sztm
0
100
JAWS-UG朝会_41_NakagawaAkihiro.pptx.pdf
anakagawa
2
610
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
56
2.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
13
1.1k
We Have a Design System, Now What?
morganepeng
37
5.9k
Gamification - CAS2011
davidbonilla
75
4.1k
VelocityConf: Rendering Performance Case Studies
addyosmani
317
22k
Done Done
chrislema
178
14k
Statistics for Hackers
jakevdp
785
210k
Designing the Hi-DPI Web
ddemaree
273
32k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
270
12k
It's Worth the Effort
3n
177
26k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
109
16k
Thoughts on Productivity
jonyablonski
49
2.7k
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/