Skip to main content

Detect stop locations in time-ordered (lat, lon) location data

Project description

Infostop

Python package for detecting stop locations in mobility data

This package implements the algorithm described in (paper not written yet), for detecting stop locations in time-ordered location data.

Usage

Given a location trace such as:

>>> data 
array([[ 55.75259295,  12.34353885 ],
       [ 55.7525908 ,  12.34353145 ],
       [ 55.7525876 ,  12.3435386  ],
       ...,
       [ 63.40379175,  10.40477095 ],
       [ 63.4037841 ,  10.40480265 ],
       [ 63.403787  ,  10.4047871  ]])

A stop location solution can be obtained using:

>>> import infostop
>>> labels = infostop.best_partition(data)

Here, labels matches data in size, and can easily be mapped back onto data:

>>> np.hstack([data, labels.reshape(-1, 1)])
array([[ 55.75259295,  12.34353885,   0.        ],
       [ 55.7525908 ,  12.34353145,   0.        ],
       [ 55.7525876 ,  12.3435386 ,   0.        ],
       ...,
       [ 63.40379175,  10.40477095, 164.        ],
       [ 63.4037841 ,  10.40480265, 164.        ],
       [ 63.403787  ,  10.4047871 , 164.        ]])

Plotting this onto a map:

img

Advantages

  • Simplicity: At its core, the method works by two steps. (1) Reducing the location trace to the medians of each stationary event and (2) embedding the resulting locations into a network that connects locations that are within a user-defined distance and clustering that network.
  • Flow based: Spatial clusters correspond to collections of location points that contain large amounts of flow when represented as a network. This enables the recovery of locations where traces slightly overlap.
  • Speed: First the point space is reduced to the median of stationary points, then pairwise distances between these medians are computed using a vectorized implementation of the haversine function, and finally the resulting network at some distance threshold is clustered using the C++ based Infomap implementation. For example, clustering 70.000 location points takes aroung 16 seconds.

Installation

pip install infostop

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

infostop-0.0.10.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

infostop-0.0.10-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file infostop-0.0.10.tar.gz.

File metadata

  • Download URL: infostop-0.0.10.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3

File hashes

Hashes for infostop-0.0.10.tar.gz
Algorithm Hash digest
SHA256 4c91ea28e77a8313e7e35149a0ca352cafae9fb4453b22bbbf285fa8943a899b
MD5 d7c228d33ae692071e1694bd891195aa
BLAKE2b-256 dfaebb50c6b4f194e3067589d534cecf81855964f4ee118744c0d834e31ee611

See more details on using hashes here.

File details

Details for the file infostop-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: infostop-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3

File hashes

Hashes for infostop-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 7a299f81e8421fa0443176b7e31a81f9b7b10ae452262592d4b6980a332745cd
MD5 9fda0805ebd0eba3fead989cde7f43ee
BLAKE2b-256 e6e70ef7236afb1407ea27abf72d2c0811f077ff282f4b30fcb5d8dd1b7c3da9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page