- Open Eclipse for Java EE Developers IDE
- Click on File Menu -> Import...
- Select "Existing Projects into Workspace", and click on Next
- Select "Select archive file", and choose the zip file
traffic-collisions-mapping-tutorial.zip
, and click on Finish - DONE!
I strongly encourage you use 7 or higher versions of Java. However, if you have got a JRE 6, please note the below.
- JRE System Library: As this project is written in Java 7, if you're using Java 6, you should replace the JRE System Library with Java 6. To do this, in the Build Path configuration dialog, click on JRE System Library, and click on "Remove" button. Click on "Add Library..." button, select "JRE System Library", and select an available library to import into the build path.
- Project Facets: Again, if you're using Java 6 for development, you should change the project facets. In the project explorer, right click on the project, and choose "Properties", in the list on the left, choose "Project Facets", and change the value of Java from 1.7 to 1.6.
- Get the Virtual Machine up and running
- Open up a terminal
- Unzip the
traffic-collisions-mapping-tutorial.zip
into the folder/home/dbadmin/workspace/traffic-collisions-mapping-tutorial
- Enter the directory above
- Execute
$ cd data
- Execute
$ adminTools
- Select
6 Configuration Menu
- Select
1 Create Database
- Input database name as
nytc
- Click on OK
- Enter the password as
password
, and confirm - Input into fields
Catalog pathname
andData pathname
both as/home/dbadmin/db/nytc
- Confirm everything and create the database
- Select OK, and Select
M Main Menu
- Select
2 Connect to Database
- Execute
\i schema.sql
to create the schema - Execute
copy nypd_motor_vehicle_collisions from '/home/dbadmin/workspace/traffic-collision-mapping-tutorial/data/data_nypd_motor_vehicle_collision.tbl' delimiter '|';
- After the rows being loaded, execute
delete from nypd_motor_vehicle_collisions where longitude is null;
- In the terminal, execute
/sbin/ifconfig
to see the IP address. - Open up
src/haven/mappingtutorial/config.json
to config the DB connections properties - DONE!
The Carto DB should be able to use without any configurations. However, if you don't want to use my API Key and my carto db tables, please follow the steps below.
- Register an account at cartodb;
- Login. In your dashboard, select "Create your first table";
- Select "Empty Table", and confirm. A new web page should be opened.
- Unzip the zip file and open
cartoDBAlterTable.sql
. Copy all of its content. - Select the
SQL
icon on the right side of the webpage. Replace all of its content with what we've copied, and click on "Apply query" - Rename the table to "nytc", by clicking the table name on the top left corner.
- Click on the
Visualize
button on the top right corner, and name that visualizationNew York Traffic Collisions
- Clck on the
Share
button on the top right corner, and copy the url under thecarto.js
section. - Open the
WebContent/js/script.js
file, and replace the value of the variablecartodbMapUrl
in line 14 to the content that you just copied. - Open your dashboard, and on the top right corner, click your name and select "Your API Keys", copy the API Key.
- Open the
config.json
file, fromsrc/haven/mappingtutorial/
, and replace the cartodb api key with what you just copied. - Run the Java EE project from Eclipse. Open up the index page in a modern browser, toggle the filter form, and limit the time interval from start date and end date in 3 days. Click on "Filter" button.
- See the dots showing on the map.
- Open your visulization in cartodb.com. Open "MAP VIEW".
- Click on the "infowindow" icon on the right.
- Click on the "Change HTML" small icon in the opened editor.
- Open the file
visulizationClickTooltip.html
, under the root folder of our unzipped folder. - Copy all of the content from this html file to the editor opened in the webpage, and click on
Apply
button. - DONE!