Parking is near impossible to find in Santa Monica. In addition, the data in the City of Santa Monica Parking API is not being fully utilized.
A web app that directs you to the closest available parking meter in Santa Monica.
The City of Santa Monica Parking API provides information on 6700+ meters local to Santa Monica. Hundreds of meter events are sent to the API per minute. We took this data and processed it behind the scenes using two different servers (following service oriented architecture practices) and created an app that uses that data to facilitate reasonable and responsive meter parking decisions for the user.
- City of Santa Monica Parking Data API
- Google Maps APIs
- Google Maps JavaScript API v3 - Google Maps functionality via JS
- Google Maps Embed API - Embeds your maps on different pages
- Google Maps Directions API - Path calculation and rendering
- Google Maps Geocoding API - Coordinate calculation via address strings or Latitude/Longitude tuples
- npm install - server dependencies
- bower install - client dependencies
- gulp
We loosely modeled the directory structure from the information in this article
- Primary functionality is split up into custom directives
- Map
- Modal
- Team
- Services are arranged into separate directories w/ an index.js that requires the service into a module of the same name
- Directions - Calculates and renders path on Google Maps
- Geocoder - Parses location data
- Locator - Creates a database user based on user location
- Map - Initializes the map
- Markers - Contains methods for User and Parking Meter models
- Traffic - Adds a Traffic layer to Google Maps
- User - Watches user position by monitoring browser geolocation data.
IMPORTANT: If you are cloning this repo, create a file in the root directory called firebaselink.js that contains:
module.exports = { url: 'URL for your firebase database' };
This application uses two servers:
-
"Parking Spot Analyzer" Server - responsible for choosing the meters to be sent to the client. Its logic resides in server/server.js.
-
"Cloudify" Server - used to scrape the events from the City of Santa Monica parking API to keep the database updated. The source code for this server is located in the dbScrape repository.
Cloudify automatically updates the Firebase database with event information for each meter (mostRecentEvent and timeStamp fields only). We split this into a separate server so that the speed of this application would not be affected by the constantly changing meter event information. The repo can be found here.
-
- MeterID
- active - Set up once by PSA server
- latitude - Set up once by PSA server
- longitude - Set up once by PSA server
- mostRecentEvent- Continually updated with Cloudify Server
- timeStamp- Continually updated with Cloudify Server
- MeterID
-
- Firebase unique identifier
- latitude - from Google Maps API
- logitude - from Google Maps API
- range - auto set
- Recommendations
- array of MeterID objects
- Firebase unique identifier
- The client detects the user's current location and sends a GET request to the PSA server.
- The PSA server stores the location as a unique user in the database so that personalized parking recommendations can be stored.
- The PSA server pings the database and iterates through all 6700+ meters to find the ones within 0.2 miles that currently show as empty (or SE). This data is sure to be accurate as it is continuously updated by the Cloudify server. The meters are added to an array of objects.
- The PSA server sorts this array of meter-information objects by distance and responds to the client with it.
- The client maps the closet meter on the map.