Difference between revisions of "Spatial Pattern Analysis with CartoDB"

From CUOSGwiki
Jump to navigationJump to search
Line 13: Line 13:
 
===Add CartoDB GIS PPA===
 
===Add CartoDB GIS PPA===
 
sudo add-apt-repository ppa:cartodb/gis
 
sudo add-apt-repository ppa:cartodb/gis
Add CartoDB Mapnik PPA
+
===Add CartoDB Mapnik PPA===
 
sudo add-apt-repository ppa:cartodb/mapnik
 
sudo add-apt-repository ppa:cartodb/mapnik
Add Mapnik Boost PPA
+
===Add Mapnik Boost PPA===
 
sudo add-apt-repository ppa:mapnik/boost
 
sudo add-apt-repository ppa:mapnik/boost
Add Chris Lea’s Nodejs Legacy PPA
+
===Add Chris Lea’s Nodejs Legacy PPA===
 
sudo add-apt-repository ppa:chris-lea/node.js-legacy
 
sudo add-apt-repository ppa:chris-lea/node.js-legacy
Add CartoDB Redis PPA
+
===Add CartoDB Redis PPA===
 
sudo add-apt-repository ppa:cartodb/redis
 
sudo add-apt-repository ppa:cartodb/redis
Add CartoDB PostgreSQL PPA
+
===Add CartoDB PostgreSQL PPA===
 
sudo add-apt-repository ppa:cartodb/postgresql
 
sudo add-apt-repository ppa:cartodb/postgresql
   
Install unp
+
===Install unp===
 
sudo apt-get install unp
 
sudo apt-get install unp
Install zip
+
===Install zip===
 
sudo apt-get install zip
 
sudo apt-get install zip
   
Install GEOS
+
===Install GEOS===
 
sudo apt-get install libgeos-c1 libgeos-dev
 
sudo apt-get install libgeos-c1 libgeos-dev
   
Install GDAL
+
===Install GDAL===
 
sudo apt-get install gdal-bin libgdal1-dev
 
sudo apt-get install gdal-bin libgdal1-dev
   
Install JSON-C
+
===Install JSON-C===
 
sudo apt-get install libjson0 python-simplejson libjson0-dev
 
sudo apt-get install libjson0 python-simplejson libjson0-dev
   
Install PROJ
+
===Install PROJ===
 
sudo apt-get install proj-bin proj-data libproj-dev
 
sudo apt-get install proj-bin proj-data libproj-dev
   
Install PostgreSQL
+
===Install PostgreSQL===
 
sudo apt-get install postgresql-9.1 postgresql-client-9.1 postgresql-contrib-9.1 postgresql-server-dev-9.1
 
sudo apt-get install postgresql-9.1 postgresql-client-9.1 postgresql-contrib-9.1 postgresql-server-dev-9.1
   
plpython is required for Python support
+
===plpython is required for Python support===
 
sudo apt-get install postgresql-plpython-9.1
 
sudo apt-get install postgresql-plpython-9.1
   
Install PostGIS
+
===Install PostGIS===
 
cd /usr/local/src
 
cd /usr/local/src
 
sudo wget http://download.osgeo.org/postgis/source/postgis-2.0.2.tar.gz
 
sudo wget http://download.osgeo.org/postgis/source/postgis-2.0.2.tar.gz
Line 87: Line 87:
 
sudo su postgres
 
sudo su postgres
   
Rune the following command
+
Run the following command
 
./es.sh
 
./es.sh
   
Install Ruby 1.9.1
+
===Install Ruby 1.9.1===
 
sudo get-apt install ruby1.9.1
 
sudo get-apt install ruby1.9.1
   
Install Node.js
+
===Install Node.js===
 
sudo apt-get install nodejs=0.8.26-1chl1~precise1
 
sudo apt-get install nodejs=0.8.26-1chl1~precise1
   
Install NPM
+
===Install NPM===
 
sudo apt-get install npm=1.3.0-1chl1~precise1
 
sudo apt-get install npm=1.3.0-1chl1~precise1
   
Install Redis
+
===Install Redis===
 
sudo apt-get install redis-server
 
sudo apt-get install redis-server
   
Install EASY INSTALL
+
===Install EASY INSTALL===
 
sudo apt-get install python-setuptools
 
sudo apt-get install python-setuptools
   
Install Python dependencies
+
===Install Python dependencies===
 
cd cartodb20
 
cd cartodb20
 
sudo easy_install pip
 
sudo easy_install pip
 
sudo pip install -r python_requirements.txt
 
sudo pip install -r python_requirements.txt
   
Install Varnish
+
===Install Varnish===
 
sudo apt-get install varnish
 
sudo apt-get install varnish
   
Install Mapnik
+
===Install Mapnik===
 
sudo apt-get install libmapnik-dev python-mapnik2 mapnik-utils
 
sudo apt-get install libmapnik-dev python-mapnik2 mapnik-utils
   
 
===Install CartoDB SQL API===
 
Install CartoDB SQL API
 
   
 
git clone git://github.com/CartoDB/CartoDB-SQL-API.git
 
git clone git://github.com/CartoDB/CartoDB-SQL-API.git
Line 133: Line 132:
 
node app.js development
 
node app.js development
   
Install Windshaft-cartodb
+
===Install Windshaft-cartodb===
 
git clone git://github.com/CartoDB/Windshaft-cartodb.git
 
git clone git://github.com/CartoDB/Windshaft-cartodb.git
 
cd Windshaft-cartodb
 
cd Windshaft-cartodb
Line 147: Line 146:
 
node app.js development
 
node app.js development
   
Install Vim
+
===Install Vim===
 
sudo apt-get install vim
 
sudo apt-get install vim
   
Running CartoDB
+
===Running CartoDB ===
 
cd cartodb20
 
cd cartodb20
   
Line 171: Line 170:
 
$ bundle exec rails s -p 3000
 
$ bundle exec rails s -p 3000
   
  +
===Browser===
 
You should now be able to access http://<mysubdomain>.localhost.lan:3000 in your browser and login with the password specified above.
 
You should now be able to access http://<mysubdomain>.localhost.lan:3000 in your browser and login with the password specified above.
   

Revision as of 00:18, 25 December 2013

Introduction

Install Guide

   git clone --recursive https://github.com/CartoDB/cartodb20.git

ADD CartoDB Personal Package Archives (PPAs)

Add CartoDB GIS PPA

   sudo add-apt-repository ppa:cartodb/gis

Add CartoDB Mapnik PPA

   sudo add-apt-repository ppa:cartodb/mapnik

Add Mapnik Boost PPA

   sudo add-apt-repository ppa:mapnik/boost

Add Chris Lea’s Nodejs Legacy PPA

   sudo add-apt-repository ppa:chris-lea/node.js-legacy

Add CartoDB Redis PPA

   sudo add-apt-repository ppa:cartodb/redis

Add CartoDB PostgreSQL PPA

   sudo add-apt-repository  ppa:cartodb/postgresql

Install unp

   sudo apt-get install unp

Install zip

   sudo apt-get install zip

Install GEOS

   sudo apt-get install libgeos-c1 libgeos-dev

Install GDAL

   sudo apt-get install gdal-bin libgdal1-dev

Install JSON-C

   sudo apt-get install libjson0 python-simplejson libjson0-dev

Install PROJ

   sudo apt-get install proj-bin proj-data libproj-dev

Install PostgreSQL

   sudo apt-get install postgresql-9.1 postgresql-client-9.1 postgresql-contrib-9.1 postgresql-server-dev-9.1

plpython is required for Python support

   sudo apt-get install postgresql-plpython-9.1

Install PostGIS

   cd /usr/local/src
   sudo wget http://download.osgeo.org/postgis/source/postgis-2.0.2.tar.gz
   sudo tar xzf postgis-2.0.2.tar.gz
   cd postgis-2.0.2
   ./configure --with-raster --with-topology
   make
   make install

We are going to use the file manager and navigate to the following folder starting from the computer folder and ending with postgis-2.0.2

   /usr/local/sr/postgis-2.0.2

Create a new empty document, name/label it es.sh

Open the folder, paste and save the following, and finally close it.


   #!/usr/bin/env bash
   POSTGIS_SQL_PATH='pg_config --sharedir'/contrib/postgis-2.0
   createdb -E UTF8 template_postgis
   createlang -d template_postgis plpgsql
   psql -d postgres -c \
   "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis'"
   psql -d template_postgis -f postgis/postgis.sql
   psql -d template_postgis -f spatial_ref_sys.sql
   psql -d template_postgis -f postgis/legacy.sql
   psql -d template_postgis -f taster/rt_pg/rtpostgis.sql
   psql -d template_postgis -f topology/topology.sql
   psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"
   psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"

Back in the terminal, we are back where we started: sudo cd postgis-2.0.2

Run the following command

   sudo chmod 777 es.sh

Change user to postgres

   sudo su postgres

Run the following command

  ./es.sh

Install Ruby 1.9.1

   sudo get-apt install ruby1.9.1

Install Node.js

   sudo apt-get install nodejs=0.8.26-1chl1~precise1

Install NPM

   sudo apt-get install npm=1.3.0-1chl1~precise1

Install Redis

   sudo apt-get install redis-server

Install EASY INSTALL

   sudo apt-get install python-setuptools

Install Python dependencies

  cd cartodb20
  sudo easy_install pip
  sudo pip install -r python_requirements.txt

Install Varnish

  sudo apt-get install varnish

Install Mapnik

  sudo apt-get install libmapnik-dev python-mapnik2 mapnik-utils

Install CartoDB SQL API

  git clone git://github.com/CartoDB/CartoDB-SQL-API.git
  cd CartoDB-SQL-API
  git checkout master
  npm install
  cd CartoDB-SQL-API
  cd config/environments/
  mv development.js.example development.js
  cd
  cd CartoDB-SQL-API 
  node app.js development

Install Windshaft-cartodb

   git clone git://github.com/CartoDB/Windshaft-cartodb.git
   cd Windshaft-cartodb
   git checkout master
   npm install
   cd config/environments/
   mv development.js.example development.js
   cd
   cd Windshaft-cartodb
   node app.js development

Install Vim

   sudo apt-get install vim

Running CartoDB

  cd cartodb20
 # NOTE: the default server port is 6379
   redis-server
   rvm use 1.9.2@cartodb --create && bundle install
   mv config/app_config.yml.sample config/app_config.yml
   vim config/app_config.yml
   mv config/database.yml.sample config/database.yml
   vim config/database.yml
   echo "127.0.0.1 ${SUBDOMAIN}.localhost.lan" | sudo tee -a /etc/hosts
   sh script/create_dev_user ${SUBDOMAIN}
   $ QUEUE=* bundle exec rake resque:work
   $ bundle exec rails s -p 3000

Browser

You should now be able to access http://<mysubdomain>.localhost.lan:3000 in your browser and login with the password specified above.

User Interface

Results

References