Code Monkey home page Code Monkey logo

street-view-movie-maker's Introduction

Google Street View Movie Maker

It makes movies out of Google Street View images!

You provide point A and point B. It uses the Google Roads API to get directions from A to B, then repeatedly looks for Street View images along that path, and converts them into a movie.

E.g., here is a video taken along the Copacabana beach in Rio, with a little snippet of Senor Coconut's "Neon Lights (Cha Cha Cha)" added for fun:

Requirements

To run this code yourself takes some fussing around:

  1. Make sure FFMPEG is installed and callable from the command line. I brew-installed it.
  2. pip-install this project's python requirements. The only packages you may not have are googlemaps and polyline. Note: this project is written for Python 2.
  3. Lastly, and trickiest of all: the code requires API keys for Google Map's Street View and Directions APIs. Note: setting up the Street View API now requires a billing account! it tends to be free for small amounts of traffic, but you have to set it up anyway.

Project history

When using Google Maps to plan a route I haven't driven or walked before, I always though it would be nifty to be able to preview the directions as a video. Obviously, you can check out the route by looking at Street View at random points, or navigating in Street View mode itself. But these options are tedious!

Other people have had the same idea; at least two have created web services to do it:

In each case, the user gives points A and B, the site fetches directions, picks a set of waypoints about 150m apart, and shows you the image at each waypoint. But the sites don't download the images and compile them into a movie; they just repeatedly reload Google Street View at each waypoint. I wanted to obtain a simulated video preview.

Also, both services are basically defunct now that using the Street View API requires billing. (I last checked the functional sites in 2017.)

Project hurdles

Step 1 was downloading an image. I started with the Street View API documentation, but to get it working in Python, I used this blog post as a reference.

Step 2 was computing the route and selecting GPS points along that route. Using the Directions API was straightforward with the Python Client for Google Maps Services.

Step 3 was computing the correct heading (compass direction) from A to B, which is really tricky! I ultimately found someone else's code to do this.

But there were lots of failed hacks in between. The math for computing distances and angles on spheres is very cool---the Haversine formula, but I probably would have enjoyed learning about it more in high school. The best among them used the GeoPy package, but was ugly: with GeoPy, I couldn't compute the heading from A to B. But, given point A, a bearing, and a distance, I could compute a destination C. I could also compute the distance between any two points. So, I computed 360 potential destinations, each a degree apart and a fixed distance from A, and then found the one that was nearest to C, which gave the approximate heading.

Step 4 was concatenating the images into a movie, for which FFMPEG is indispensible!

street-view-movie-maker's People

Contributors

jblsmith avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.