2.4.0 • Published 7 years ago

probematch v2.4.0

Weekly downloads
13
License
ISC
Repository
-
Last release
7 years ago

probematch

Match a single GPS measurements (probe) or line of sequential GPS measurements (trace) to a road network.

probematch creates an rbush index of a road network to allow you to quickly match probes or traces to the roads using configurable distance and bearing filters.

terms

  • probe - a single GPS measurement, represented by a Feature<Point>
  • trace - a collection of sequential GPS measurements, represented by a Feature<LineString>
  • road - a Feature<LineString> representing a road, which we may attempt to match probes and traces to
  • roads, network, road network - a FeatureCollection of roads
  • segment - a single edge of a road. For road A -> B -> C, there are two segments: A -> B and B -> C. Segments always have only 2 points.

install

npm install probematch

configuration

var probematch = require('probematch');

var roads = {
  'type': 'FeatureCollection',
  'features': [
    // Linestring features representing the road network
  ]
};

var matcher = probematch(roads, {
  compareBearing: true,
  maxBearingRange: 5,
  bidirectionalBearing: false,
  maxProbeDistance: 0.01
});
keytypedefaultdescription
compareBearingbooleantrueShould bearing of probes be used to evaluate match quality? If true, the bearing of the probe is compared to the bearing of each possible matching road segment. This ensures probes don't match cross-streets that obviously aren't the same as the probe's direction of travel
maxBearingRangenumber5Maximum amount in degrees that a probe's bearing may differ from a road segment's when using compareBearing
bidirectionalBearingbooleanfalseShould bearing matches allow for probes to be moving in the opposite direction of a road segment's bearing? This should be true if the road network includes 2-way roads.
maxProbeDistancenumber0.01Maximum distance in kilometers that a probe may be from a road segment in order to consider it a possible match. Prevents matching probes to segments that are too far away from them.

usage

match

var probematch = require('probematch');

var roads = /* FeatureCollection of road geometries */;
var matcher = probematch(roads, {/* configuration */});

var probe = {
  type: 'Feature',
  geometry: {
    type: 'Point',
    coordinates: [0, 0]
  }
};

var probeBearing  = 57; // probe's direction of travel in degrees

var results = matcher(probe, probeBearing);

The result of matching a single proble is an array of possible matches to the road network. Results are ordered by the probe's distance from the candidate road.

Each possible match represents a single segment of a road that is likely to have matched the probe - Multiple segments from the same road could be in the array.

keytypedescription
roadFeature<LineString>The geometry of a road that may have been matched
segmentFeature<LineString>The particular segment of the road that the probe may have matched
distancenumberDistance (in miles) between the probe and the segment

Segments

Each segment is a single edge of a road. For road A -> B -> C -> D, there are 3 segments:

  • A -> B
  • B -> C
  • C -> D

As a segment always represents a single edge, segments have only 2 points.

Segments contain specific properties, generated by probematch when the road network is indexed.

segment.properties
keytypedescription
roadIdintIndex in the original road network FeatureCollection of the road this segment belongs to. If roadId = 3, this segment's associated road is roads.features[3]
segmentIdintIndex indicating which edge of the road this segment is. For road A -> B -> C, A -> B has segmentId = 0B -> C has segmentId = 1
bearingnumberThe absolute bearing of the segment, used when matching probe bearing.

matchTrace

var probematch = require('probematch');

var roads = /* FeatureCollection of road geometries */;
var matcher = probematch(roads, {/* configuration */});

var results = matcher.matchTrace(line);

matchTrace returns an array of match results. The order of results is the same as the order of the coordinates in the input trace. This means that the zeroeth element in the matchTrace result is an array of possible matches for the zeroeth coordinate, and so on.

2.4.0

7 years ago

2.3.1

7 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago