domenica 10 luglio 2016

How to map the photos of your city like OldNYC does

Some months ago I was looking for a way to render on a map the historical photos of Ravenna collected in this Facebook Page. I stumbled upon the OldNYC project and thought it was perfect for my needs! Therefore I forked the project on Github, worked on it and this is the result : www.oldra.it.
In this tutorial which is intended for programmers, I’ll try to explain which are the main steps for reusing the code of OldNYC (written by @danvdk) , and setup the photo map of your city.






At this moment my system has a backend hosted in a Ubuntu virtual machine on my PC and a frontend (a static site) hosted in the cloud. In order to collect the newer posts of the Facebook Page the backend harvests from Facebook and re-generates once a week all of the static pages of the static site and sends them to the cloud to be served by www.oldra.it.

The system

The developement environment and the backend run on a Ubuntu Server 16.04 virtual machine.
  1. First of all I forked the 2 Github repos https://github.com/danvk/oldnyc for the backend and https://github.com/oldnyc/oldnyc.github.io for the static site, then I cloned them on my server with the git clone command (git clone git://github.com/danvk/oldnyc.git git clone git://github.com/danvk/oldnyc.github.io.git). After that my home directory looks like that :


2. I installed python2.7 (do not install python 3) :  apt-get install python2.7
3. I installed virtualenv : apt-get install virtualenv
4. Then I followed the instructions written by @danvdk to setup the environment :
cd oldnyc
virtualenv env
source env/bin/activate
pip install -r requirements.txt
     I did not use Google App Engine therefore did not run ./develop.py
     I installed the numpy package : pip install numpy
5. Created some directories necessary for the backend to work :
   mkdir oldnyc/gecocache
   mkdir oldnyc/images
   mkdir oldnyc/thumbnails
6. Fot testing purposes Installed an Apache web server : apt-get install apache2
   Configured it to listen on localhost and serve the content of the directory oldnyc.github.io ,
which is the static site that will be hosted in the cloud.