The inspiration behind this application was for me to learn more about spring-boot and Angular. The dataset used is provided by the OpenBaltimore Initiative. The dataset can be found on OpenBaltimore and was accessible via Socrata's java library(SODA) which called upon their API. Although this data could have easily been obtained/queried via the available API and entered into the map; I choose to go with a database approach. This required me to import the data from the API into a database(H2/MySQL) via a batch process before serving the data into the heat map.
The front end ultilizes the following APIs/Libraries:
- Google Maps JavaScript API - used to create heat map
- Angular - front end framework
- NoUISlider - Time slider
- BootStrap - A touch to keep the web page out of the early 2000s.
- A sprinkle of different angular directives
Behind The Scenes:
- Spring Boot - Meat and potatas.
- Lombok - Time saver
- soda-api-java - Get some SODA
- Google Map Services Java Libraries - Used for GeoCoding. Address to Long/Lat. Limited to 2,500 calls a day.
- mockito - Tasty mocks for unit testing.
- powermock - Get lit unit testing!
- wro4j - Build project to get javascript libs in one place.
Service Providers:
- MySQL - DeckerServices or ClearDB1
- Application Hosting - Pivotal Cloud Foundry
- Javascript libary hosting - CDNJS
1: The initial DB host is Decker, but if there are concerns about network latency, it can be switched over to ClearDB.
The inital implementation will be limited to just March 2016 as the Google Geocoding API calls are limited. This could easily be circumvented by enabling the batch process to import 2,500 records each day.
Instructions on deploying locally.
To run this application locally there are a few prerequisites you must have:
- Maven installed.
- Google Maps API key obtainable here. Please enable the "Google Maps Geocoding API" from the Google Developer Console.
- (Optional) A mysql database running with proper permission and connection details
- Rename application.properties.example to application.properties
- Replace "YOUR_API_KEY" with the Google Maps API Key obtained above.
- Uncomment the appropriate database section that you would prefer to use. H2 or MySQL.
- On the first start up of a MySQL instance you will want the schema to be created. You can create the schema using the following:
spring.jpa.hibernate.ddl-auto=create
. After, you may continue to usevalidate
so you limit the number of calls to Google's Geo service.
- Run
mvn clean spring-boot:run -Dsoda.query.limit=XXXX
. 'XXXX' is the amount of data you would like to import into your instance. This property will limit the amount of data that is to be returned from the SODA API query.-Dsoda.query.limit=XXXX
is optional. Defaults to 0 if not provided.
Bugs can be tracked or reported in the issues tab.