Package mosp :: Package external_persons :: Module external_data_manager :: Class ConnectionService
[hide private]
[frames] | no frames]

Class ConnectionService

source code


Instance Methods [hide private]
 
__init__(self, address, port, conn, map_path, free_move_only, hmac_key)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
dummylocation(self, id='', lat='', lon='', acc='', speed='', bearing='') source code
 
location(self, id='', lat='', lon='', acc='', hmac='')
Handle incoming location from $HOSTNAME:$PORT/location?$PARAMS.
source code
 
add_match(self, time, id, x, y, acc, way_segment)
Add a new set of values to the known locations and remove an old one if necessary.
source code
 
fuzzy_map_match(self, id, x, y, acc, time)
Match the received coordinates to the OSM-map using fuzzy logic.
source code
 
initial_fuzzy_match(self, x, y, previous_x, previous_y, acc, candidates=None)
Perform initial map match based on fuzzy logic using the peach package.
source code
 
subsequent_fuzzy_match(self, x, y, acc, segment, id)
Perform subsequent matching along the identified segment and check for transition into new segment.
source code
 
calculate_angle(self, start1, end1, start2, end2)
Calculate the angle between two lines identified by start and end points.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, address, port, conn, map_path, free_move_only, hmac_key)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

dummylocation(self, id='', lat='', lon='', acc='', speed='', bearing='')

source code 
Decorators:
  • @expose

location(self, id='', lat='', lon='', acc='', hmac='')

source code 

Handle incoming location from $HOSTNAME:$PORT/location?$PARAMS.

Decorators:
  • @expose

add_match(self, time, id, x, y, acc, way_segment)

source code 

Add a new set of values to the known locations and remove an old one if necessary.

Parameters:
  • time - Timestamp of receive-time
  • id - id of the person
  • x - x coordinate of received location
  • y - y coordinate of received location
  • acc - accuracy of received location
  • way_segment - the current way segment the person was matched to

fuzzy_map_match(self, id, x, y, acc, time)

source code 

Match the received coordinates to the OSM-map using fuzzy logic.

Algorithm is based on http://d-scholarship.pitt.edu/11787/4/Ren,_Ming_Dissertation.pdf (Chapter 4.3)

Parameters:
  • id - id of the person
  • x - x coordinate of received location
  • y - y coordinate of received location
  • acc - accuracy of received location
  • time - timestamp of receival
Returns:
a list with format [person_id, node_id_start, node_id_end, matched_x, matched_y, time_received] or None if no match was found

initial_fuzzy_match(self, x, y, previous_x, previous_y, acc, candidates=None)

source code 

Perform initial map match based on fuzzy logic using the peach package.

Parameters:
  • x - x coordinate of received location
  • y - y coordinate of received location
  • previous_x - x coordinate of last received location
  • previous_y - y coordinate of last received location
  • acc - accuracy of received location
  • candidates - an iterable containing a set of predefined candidate segments (default is None)
Returns:
a tuple containing (identified segment, matched x, matched y)

subsequent_fuzzy_match(self, x, y, acc, segment, id)

source code 

Perform subsequent matching along the identified segment and check for transition into new segment.

Parameters:
  • x - x coordinate of received location
  • y - y coordinate of received location
  • acc - accuracy of received location
  • segment - the way segment the person is currently moving on
Returns:
a tuple containing (identified segment, matched x, matched y)

calculate_angle(self, start1, end1, start2, end2)

source code 

Calculate the angle between two lines identified by start and end points.

Parameters:
  • start1 (tuple (x, y)) - starting point of line one
  • end1 (tuple (x, y)) - ending point of line one
  • start2 (tuple (x, y)) - starting point of line two
  • end2 (tuple (x, y)) - ending point of line two
Returns:
angle in degrees as integer