Skip to content

Davidelvis/Vehicle_geofencing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Vehicle Geofencing Project

Geofencing is the use of the Global Positioning System (GPS) satellite network and/or local radio-frequency identifiers (such as WiFi nodes or Bluetooth beacons) to create virtual boundaries around a location.

In this use case, we push real-time vehicle location data into Kafka. We will keep the static data of the vehicle which contains the starting point of the vehicle and the threshold distance in Kafka and push it into Hazelcast. Real-time vehicle data will be read by Storm, which starts processing every vehicle event. It checks the distance of the current location and the location defined by the user. If the vehicle goes beyond the threshold distance, then an alert is generated.

Data review

The real-time vehicle sensor data model is:

Field name Data type
Vehicle Id String
Latitude Double
Longitude Double
Speed Integer
Timestamp Long

|

The Vehicle Id is the unique identifier of any vehicle. Generally, it is the chassis number shown in different locations for different types of vehicle. Latitude and Longitude are detected by GPS which tells us the current location. Speed is the speed of the vehicle. Timestamp is the time when this event was generated.

The static vehicle data model is:

Field name Data type
Vehicle Id String
Latitude Double
Longitude Double
Distance Double
Phone number String

|

This static data is provided by the owner of the vehicle while setting up the alert for his/her vehicle. The Vehicle Id is the unique identifier of any vehicle. Latitude and Longitude are the starting location of the vehicle or the location from where distance is calculated to check the alert. Distance is the threshold distance in meters. The Phone number is used to send a notification in case of an alert ID being generated.

Output is pushed into Elasticsearch. There will be two types of data models used. One for saving real-time vehicle sensor data and the other for alert informationgenerated by the system.

Real-time sensor data model:

Field name Data type
Coords Geo_point
Speed Integer
Timestamp Date
Vehicle Id Text

|

Coords contains latitude and longitude in JSON format which is converted into geo_point type by Elasticsearch. Speed is the speed of the vehicle. Timestamp is the time the event occurred. Vehicle_id is the unique identifier of the vehicle.

Alert Information data model:

Field name Data type
Actual_coords Geo_point
Expected_distance Double
Actual_distance Double
Expected_coords Geo_point
Timestamp Date

|

Actual_coords contains the real-time current latitude and longitude of the vehicle aslocation. Expected_distance is the threshold value of distance configured by the userfor their vehicle. Actual_distance is the current distance between the actual_coords and the expected_coords. Expected_coords is the starting point or location configured by theuser while setting up the vehicle alert. Timestamp is the time of the alert generated by the system. Vehicle_id is the unique identifier of the vehicle.

Two types of Maps will be created by Hazelcast to process events in real-time: VehicleAlertInfo and GeneratedAlerts. In VehicleAlertInfo, the Map key is the vehicle id and the value is a java object which contains the vehicleId, latitude, longitude, distance, and phoneNumber. The GeneratedAlerts Map key is the vehicle id and the value is thresholdDistance, actualDistance, startingLatitude, startingLongitude, actualLatitude, actualLongitude, vehicleId, timestamp, and phoneNumber.

Tools and Frameworks

The following tools and frameworks are used to implement this project:

Name Version
Java 1.8
Zookeeper 3.4.6
Kafka 2.11-0.8.2.2
Hazelcast 3.8
Storm 1.1.1
Elasticsearch 5.2.2
Kibana 5.2.2

|

About

Real-time vehicle location

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published