retroplasma / flyover-reverse-engineering
- вторник, 12 марта 2019 г. в 00:16:49
Go
Reversing Apple's 3D satellite mode
This is an attempt to reverse-engineer Flyover (= 3D satellite mode) from Apple Maps. Main goal is to document the results and to provide code that emerges.
Noticed differences between Google Earth and Apple Flyover during previous project. Extreme example:
| Google Earth | Apple Flyover |
|---|---|
![]() |
![]() |
Data is stored in map tiles. These five tile styles are used for Flyover:
| Type | Purpose | URL structure |
|---|---|---|
| C3M | Texture, Mesh, Transformation(, Animation) | 🅐(?|&)style=15&v=⓿®ion=❶&x=❷&y=❸&z=❹&h=❺ |
| C3MM 1 | Metadata | 🅐(?|&)style=14&v=⓿&part=❻®ion=❶ |
| C3MM 2 | Metadata | 🅐(?|&)style=52&v=⓿®ion=❶&x=❷&y=❸&z=❹&h=❺ |
| DTM 1 | Terrain/Surface/Elevation | 🅐(?|&)style=16&v=⓿®ion=❶&x=❷&y=❸&z=❹ |
| DTM 2 | Terrain/Surface/Elevation | 🅐(?|&)style=17&v=⓿&size=❼&scale=❽&x=❷&y=❸&z=❹ |
ResourceManifest
└─ AltitudeManifest
├─ C3MM
│ └─ C3M
└─ DTM?
Focusing on C3M(M) for now. DTMs are just images with a footer; they're probably used for the grid that is displayed when Maps is loading.
This repository is structured as follows:
| Directory | Description |
|---|---|
| cmd | command line programs |
| pkg | most of the actual code |
| proto | protobuf files |
| scripts | additional scripts |
| vendor | dependencies |
Clone repo including submodules and install Go. Then edit config.json:
./scripts/get_config_macos.sh > config.jsonresourceManifestURL: from com.apple.GEO.plist or GeoServices binarytokenP1: from GeoServices binary (function: GEOURLAuthenticationGenerateURL)Here are some independent command line programs that use code from pkg:
This exports Santa Monica Pier to ./export:
go run cmd/poc-export-obj/main.go
This authenticates a URL using parameters from config.json:
go run cmd/auth/main.go [url]
This parses a C3M v3 file, decompresses meshes, reads JPEG textures and produces a struct that contains a textured 3d model:
go run cmd/parse-c3m/main.go [file]
go run cmd/parse-c3mm/main.go [file]
~/Library/Preferences/com.apple.GEO.plist
~/Library/Caches/GeoServices/Resources/altitude-*.xml
altitude-*.xml url in resource manifest~/Library/Containers/com.apple.geod/Data/Library/Caches/com.apple.geod/MapTiles/MapTiles.sqlitedb
/System/Library/PrivateFrameworks/GeoServices.framework/GeoServices
/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit
/System/Library/PrivateFrameworks/GeoServices.framework/XPCServices/com.apple.geod.xpc
GeoServices/Applications/Maps.app/Contents/MacOS/Maps
VectorKitTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.