DC Crime Heat Map is a web appliction that uses MapBox web tiles and Leaflet to display a heatmap of all crime incidents in Washington, DC. The original dataset is available to the public provided by the Disttrict of Columbia's data website.
The front-end portion of the app uses MapBox's JavaScript library for the base tile layers. The leaflet.heat Leaflet heatmap plugin is used as well as the Cluster Layer plugin. All front-end dependencies are managed by bower so the following is needed:
- nodejs
- bower (must be installed globally)
To download and generate the data, the following is needed:
- bash (if on Windows, install cygwin)
- curl
- python
- pyproj (version 1.9.4) python module
- pymongo python module
First be sure that you have pyproj installed.
On apt-get based Linux systems you should be able to install with something like the following:
$ sudo apt-get install python-pyproj
If you're on a Mac or your Linux distribution did not package the module, download it and execute the following:
$ tar zxvf pyproj-1.9.3.tar.gz
$ cd pyproj-1.9.3
$ python setup.py build
$ sudo python setup.py install
After pyproj is installed, clone this repository and run bower
$ bower install
The python script also needs to connect to mongodb using pymongo. Install it on a Mac using easy_install. See the mongodb docs for installation
sudo easy_install pymongo
Next run the download script
$ cd scripts
$ ./getCrimeData.sh
The download script retrieves the data, uncompresses and then uses a python script to parse the data, convert the coordinates and output json files into the html/js/data folder.
The Mocha test framework is used for unit tests in addition to Chai for the assertions. To run the test suite, enter the following command:
$ npm test
MongoDB runs when running grunt serve. Currently working on offloading static files to mocha