Data Assembly

Milestone #2: Data Assembly

The second step of this project is to access the Google Street View data and organize it in a suitable format. In my project plan my target was to reach this goal by February 21st (last Wednesday). Although I have accomplished a lot, I have not achieved all of the things I wanted to achieve for this milestone. I expect to hit it by next week at the latest.

Here's what I have achieved.

First, I can download all of the relevant data from Google. This includes all of the panorama image data and meta data. I can also access the panorama ids for the neighboring locations. All of the metadata is stored in a database.

In [1]:
%cd ..
In [2]:
from common import db

data = db.dump_database()

pano_id h43_C8RtuVS-eyaBTeDuLw
road_argb 2164127858
road_description Broadway
description 719 Broadway
lat 40.7293
lng -73.9935
pano_date 2017-09
elevation_egm96_m -14.6791
elevation_wgs84_m -14.6791
links [('4ElQmDQdNK49Kc_Mxjp1Tw', 31.38), ('6pXUO87O...
link_count 2
download_date 2018-02-27 23:31:03
job_name test
metadata_complete Y
tiles_complete Y

Below are the database table column names.

In [3]:

The download code is written in such a way that the download job can be paused and resumed at a later date. This will be essential later if I hit the Google Street View API download limit of 25,000 requests per day.

The raw image files are stored in an image directory. The filenames contain the panorama id and the heading/pitch of the image. There are 6 images for each panorama id.

In [4]:
!ls -l data/images/test/ | head -6
total 18460
-rw-rw-r-- 1 jim jim 73127 Feb 27 23:32 0G-deBj1AdAD4afV_n-ARQ_000_000.jpg
-rw-rw-r-- 1 jim jim 72587 Feb 27 23:32 0G-deBj1AdAD4afV_n-ARQ_000_090.jpg
-rw-rw-r-- 1 jim jim 46300 Feb 27 23:32 0G-deBj1AdAD4afV_n-ARQ_000n090.jpg
-rw-rw-r-- 1 jim jim 66686 Feb 27 23:32 0G-deBj1AdAD4afV_n-ARQ_090_000.jpg
-rw-rw-r-- 1 jim jim 69896 Feb 27 23:32 0G-deBj1AdAD4afV_n-ARQ_180_000.jpg
ls: write error: Broken pipe

Here's one of those image files. The heading of this file is 0 degrees, meaning the camera is pointing directly north.

In [5]:
from IPython.display import Image

with open('data/images/test/0G-deBj1AdAD4afV_n-ARQ_000_000.jpg', 'rb') as f:
    img =

City street with a few cars parked on the side and an apartment building in the background.

Observe the image is 640x640 pixels.

I can also look directly east:

In [6]:
from IPython.display import Image

with open('data/images/test/0G-deBj1AdAD4afV_n-ARQ_090_000.jpg', 'rb') as f:
    img =

City intersection with a few cars parked on the side and fresh and co on the corner. There are miscellaneous buildings in the background.

Or straight up:

In [7]:
from IPython.display import Image

with open('data/images/test/0G-deBj1AdAD4afV_n-ARQ_000_090.jpg', 'rb') as f:
    img =

View looking up from a new york city intersection, showing clouds and buildings reaching for the sky.

And so on. The 6 directions are north, east, south, west, up, and down.

Of course I probably don't want to use these same directions for my project. That's why I wrote code that will assemble these 6 images into any image I want. Observe:

In [8]:
from sequencing import assembler

planar = assembler.Planar('test', 2000, 1000, 500, 60)

City street with a few cars parked on the side and an apartment building in the background.

My code allows me to change the heading to arbitrary values. Here's that same location turned to the left 60 degrees:

In [9]:
import numpy as np

planar.generate('0G-deBj1AdAD4afV_n-ARQ', heading=np.deg2rad(-60))