stay_points 0.10.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 49

Stay Points Pub Travis status Coverage Status

Stay points/meaningful locations identification for Dart.

In a nutshell: Stay points are regions where and individual spent a considerable amount of time in a trajectory.

The idea is to be able to extract/identify meaningful locations for the user cause that raw location data from GPS is usually meaningless, unless you want to draw the route on the map of course.

Example of meaningful locations can be: home, work, fruit shopping, dentist, gym, airport, etc

Note that you will not receive those names, you will only get a list of stay points (a coordinate with arrival and departure time)

The idea is that you pass a full log of GPS data, then will iterate over the full path to extract candidate locations to form the cluster to create the stay point

Example 1: Cantidate locations to create the stay points in green the full path, in red the locations that will be part of the stay-point cause they pass the threshold validation before stay points

Example 2: Stay points stay_points

Example of usage:

main() {
    Threshold threshold = new Threshold(minimumTime: new Duration(minutes: 4), minimumDistance: new Distance(meters: 20.0));

    var extractor = new StayPointIdentification(threshold);
    DateTime date1 = new DateTime(2017, 9, 27, 13, 06, 29);
    Location location1 = new Location.fromDegrees(
        latitude: 41.141903,
        longitude: 1.401316,
        timestamp: date1
    );

    DateTime date2 = new DateTime(2017, 9, 27, 13, 12, 11);
    Location location2 = new Location.fromDegrees(
        latitude: 41.141183,
        longitude: 1.401788,
        timestamp: date2);

    List<StayPoint> stayPoints = extractor.process(locations: [location1, location2]);
    StayPoint first = stayPoints.first;
    int detected = stayPoints.length;
    print("Stay points detected for the provided location path: ${detected}");
    print("First Stay-point detected centroid: ${first.latitude.degrees},${first.longitude.degrees}, arrival: ${first.arrival}, departurde: ${first.departure}");
}

Disclaimer: This library is an implementation of the algorithm described in Quannan Li , Yu Zheng , Xing Xie , Yukun Chen , Wenyu Liu , Wei-Ying Ma, Mining user similarity based on location history, Proceedings of the 16th ACM SIGSPATIAL international conference on Advances in geographic information systems, November 05-07, 2008, Irvine, California doi>10.1145/1463434.1463477

Changelog

0.0.5

  • Initial version with offline stay-point detection offline = grab a full path, at at the end process the list of locationspu

0.0.7

  • Minor update to fix README links

0.0.9

  • Minor update to README

0.10.0

  • Filter invalid coordinates (wrong latitude|longitude) before processing

0.10.1

  • Minor update to remove the upper bound sdk constraint limit

example/stay_points_example.dart

import 'package:stay_points/stay_points.dart';
import 'package:units/units.dart';

main() {
    Threshold threshold = new Threshold(minimumTime: new Duration(minutes: 4), minimumDistance: new Length.fromMeters(value: 20.0));

    var extractor = new StayPointIdentification(threshold);
    DateTime date1 = new DateTime(2017, 9, 27, 13, 06, 29);
    Location location1 = new Location.fromDegrees(
        latitude: 41.141903,
        longitude: 1.401316,
        timestamp: date1
    );

    DateTime date2 = new DateTime(2017, 9, 27, 13, 12, 11);
    Location location2 = new Location.fromDegrees(
        latitude: 41.141183,
        longitude: 1.401788,
        timestamp: date2);

    List<StayPoint> stayPoints = extractor.process(locations: [location1, location2]);
    StayPoint first = stayPoints.first;
    int detected = stayPoints.length;
    print("Stay-points detected for the provided location path: ${detected}");
    print("First Stay-point detected centroid: ${first.latitude.degrees},${first.longitude.degrees}, arrival: ${first.arrival}, departurde: ${first.departure}");
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  stay_points: ^0.10.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:stay_points/stay_points.dart';
  
Version Uploaded Documentation Archive
0.10.1 Feb 10, 2018 Go to the documentation of stay_points 0.10.1 Download stay_points 0.10.1 archive
0.10.0 Oct 12, 2017 Go to the documentation of stay_points 0.10.0 Download stay_points 0.10.0 archive
0.0.9 Oct 11, 2017 Go to the documentation of stay_points 0.0.9 Download stay_points 0.0.9 archive
0.0.8 Oct 11, 2017 Go to the documentation of stay_points 0.0.8 Download stay_points 0.0.8 archive
0.0.7 Oct 7, 2017 Go to the documentation of stay_points 0.0.7 Download stay_points 0.0.7 archive
0.0.6 Oct 7, 2017 Go to the documentation of stay_points 0.0.6 Download stay_points 0.0.6 archive
0.0.5 Oct 7, 2017 Go to the documentation of stay_points 0.0.5 Download stay_points 0.0.5 archive
0.0.1 Oct 7, 2017 Go to the documentation of stay_points 0.0.1 Download stay_points 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
20
Health:
Code health derived from static analysis. [more]
75
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
49
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:stay_points/stay_points.dart.

Health issues and suggestions

Fix lib/src/identification/model/coordinate.dart. (-25.38 points)

Analysis of lib/src/identification/model/coordinate.dart failed with 1 error, 1 hint:

line 8 col 45: Undefined name 'PI'.

line 1 col 8: Unused import: 'dart:math'.

Format lib/src/identification/extra/location_constraint.dart.

Run dartfmt to format lib/src/identification/extra/location_constraint.dart.

Format lib/src/identification/model/accuracy.dart.

Run dartfmt to format lib/src/identification/model/accuracy.dart.

Fix additional 8 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/identification/model/location.dart (Run dartfmt to format lib/src/identification/model/location.dart.)
  • lib/src/identification/model/location_list.dart (Run dartfmt to format lib/src/identification/model/location_list.dart.)
  • lib/src/identification/model/stay_point.dart (Run dartfmt to format lib/src/identification/model/stay_point.dart.)
  • lib/src/identification/model/threshold.dart (Run dartfmt to format lib/src/identification/model/threshold.dart.)
  • lib/src/identification/offline/offline_identification.dart (Run dartfmt to format lib/src/identification/offline/offline_identification.dart.)
  • lib/src/identification/online/online_identification.dart (Run dartfmt to format lib/src/identification/online/online_identification.dart.)
  • lib/src/stay_points_base.dart (Run dartfmt to format lib/src/stay_points_base.dart.)
  • lib/stay_points.dart (Run dartfmt to format lib/stay_points.dart.)

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <3.0.0
great_circle_distance ^1.0.0 1.0.1
units ^0.0.6 0.0.7
Dev dependencies
test ^0.12.0