wiki:django_gheat

Version 9 (modified by rick, 14 years ago) ( diff )

--

Introduction

This version of django_gheat is an edited version of django_gheat. The following guide will explain how to install and use django_gheat.

Install Python

Get Python 2.6 from here, or:

$ sudo apt-get install python

Install MySQL

Set up a MySQL server to your liking. Make sure you get as minimal version 3.23-5.1 due to the MySQLdb support. Then create a database for django_gheat.

$ sudo apt-get install mysql-server
$ sudo mysqladmin password password
$ echo "CREATE DATABASE project_heatmap;" | mysql -uroot -ppassword

Install MySQLdb

Get the latest version from here, make sure it's higher than 1.2.1p2

$ sudo apt-get install python-mysqldb

Install Django

Get Django 1.3 from here or check for a newer version here, then:

$ tar xzvf Django-1.3.tar.gz
$ cd Django-1.3
$ sudo python setup.py install

Install django_gheat

Get the latest django_gheat from the repository

Open ./settings.py, look for the 'DATABASES' section and edit the following lines:

# If you are using MySQL with MySQLdb, don't edit this line. 
# If you are using a different database, replace 'mysql' with 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'ENGINE': 'django.db.backends.mysql',
# The name of your database, or the path to your database file if you are using sqlite3.
'NAME': ' ',
# Connection settings for your database. Not used with sqlite3
'USER': ' ',
'PASSWORD': ' ',
'HOST': ' ',
'PORT': ' ',

Once you've entered the correct settings, you will be able to start Django.

# 'cd' to project root
# The following command will add some standard Django tables and the tables defined in django_gheat/gheat/models.py to the database
$ ./manage.py syncdb

# if using sample page, first 'cd samples/persisted', will get fixed soon
$ ./manage.py runserver

Something like this should return:

0 errors found
Django version 1.3, using settings 'persisted.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

You will now be able to browse to the location where the dev server is running. Add 'home/' to the address and a map will be displayed where heatmap tiles will be generated realtime.

Populating the database

The 'syncdb' command added the following tables to the database: ./manage.py graph_models gheat | dot -Tpng -o model.png Generated by installing django_extentions and the command: ./manage.py graph_models gheat | dot -Tpng -o model.png. NOTE: that on this moment only the gheat_meting(lat, lng, signaal) are used for generating heatmaps, so make sure you at least put some data in those columns.

Prerender heatmap

You can prerender a heatmap with the following command:

# 'cd' to project root
$ ./manage.py gen_tiles

This will prerender a heatmap with the default boundingbox specified in django_gheat/gheat/management/commands/gen_tiles.py To use a different boundingbox or colorscheme, you can customize the command:

# -s = start of the boundingbox, SW corner
# -e = end of the boundingbox, NE corner
# -c = colorscheme located in django_gheat/gheat/etc/color-schemes/
# -b = view used for creating tiles, default should be fine

$ ./manage.py gen_tiles -s 60,6 -e 66,8 -c firetrans -b serve_tile

Troubleshooting

If something is unclear or isn't working as it should, feel free to create a ticket.

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.