Home

Awesome

<img alt="header" title="Header image: 41.8902, 12.4923" width="100%" src="https://user-images.githubusercontent.com/46618410/94180911-07108600-fe9f-11ea-92d1-3d0960df4c0a.jpg">

Reverse-engineering Flyover (3D satellite mode) from Apple Maps. Similar work is done for Google Earth here.

Status

Roughly, these parts have been figured out:

We can authenticate URLs and retrieve textured 3D models from given coordinates (latitude, longitude).

General

Data is stored in map tiles. These five tile styles are used for Flyover:

TypePurposeURL structure
C3MTexture, Mesh, Transformation(, Animation)šŸ…(?|&)style=15&v=ā“æ&region=ā¶&x=ā·&y=āø&z=ā¹&h=āŗ
C3MM 1MetadatašŸ…(?|&)style=14&v=ā“æ&part=ā»&region=ā¶
C3MM 2MetadatašŸ…(?|&)style=52&v=ā“æ&region=ā¶&x=ā·&y=āø&z=ā¹&h=āŗ
DTM 1Terrain/Surface/ElevationšŸ…(?|&)style=16&v=ā“æ&region=ā¶&x=ā·&y=āø&z=ā¹
DTM 2Terrain/Surface/ElevationšŸ…(?|&)style=17&v=ā“æ&size=ā¼&scale=ā½&x=ā·&y=āø&z=ā¹

Resource hierarchy

ResourceManifest
ā””ā”€ AltitudeManifest
   ā”œā”€ C3MM
   ā”‚  ā””ā”€ C3M
   ā””ā”€ DTM?

Focusing on C3M(M) for now. DTMs are images with a footer and are probably used for the grid that is displayed when Maps is loading.

Code

This repository is structured as follows:

DirectoryDescription
cmdcommand line programs
pkgmost of the actual code
protoprotobuf files
scriptsadditional scripts
vendordependencies
Setup

Install Go 1.15.x and run:

go get -d github.com/retroplasma/flyover-reverse-engineering/...
cd "$(go env GOPATH)/src/github.com/retroplasma/flyover-reverse-engineering"

Then edit config.json:

Command line programs

Here are some command line programs that use code from pkg:

Export OBJ <sup>[code]</sup>

Usage:

go run cmd/export-obj/main.go [lat] [lon] [zoom] [tryXY] [tryH]

Parameter   Description       Example
--------------------------------------
lat         Latitude          34.007603
lon         Longitude         -118.499741
zoom        Zoom (~ 13-20)    20
tryXY       Area scan         3
tryH        Altitude scan     40

This exports Santa Monica Pier to ./downloaded_files/obj/...:

go run cmd/export-obj/main.go 34.007603 -118.499741 20 3 40

Optional: Center-scale OBJ using node.js script:

node scripts/center_scale_obj.js

In Blender (compatible tutorial here):

<img src="https://user-images.githubusercontent.com/46618410/65068957-fa06b000-d989-11e9-9091-1e71874b0b0c.png" width="300px">
Authenticate URL <sup>[code]</sup>

This authenticates a URL using parameters from config.json:

go run cmd/auth/main.go [url]
Parse C3M file <sup>[code]</sup>

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]
Parse C3MM file <sup>[code]</sup>

This parses a C3MM v1 file. The C3MM files in a region span octrees whose roots are indexed in the first file.

go run cmd/parse-c3mm/main.go [file] [[file_number]]

Files on macOS

Important

THE 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.