Code Monkey home page Code Monkey logo

probematch's Introduction

Match probe data to roads by distance and bearing

install

npm install probematch

usage

probematch creates an rbush index of a road network and allows you to match individual probe points to the roads by a combo of distance and bearing. Both distance and bearing filters are configurable.

var probematch = require('probematch');

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

var match = probematch(roads, {
  compareBearing: true, // should bearing be used to filter matches?
  maxProbeDistance: 0.01, // distance filter in kilometers for probe matching
  maxBearingRange: 5, // maximum bearing difference, in degrees, allowed for match filtering,
  bidirectionalBearing: false // allows matching probes to roads oriented in the opposite direction.
  							  // good if you know your data contains many 2-way roads
});

var probe = /* a point feature representing a probe */;
var probeBearing  = /* a bearing in degrees */

var results = match(probe, probeBearing);

lines

probematch can also match all points in a line automatically, including bearing calculation between segments. This is ideal when working with data already assembled into traces.

var probematch = require('probematch');

var roads = //;
var match = probematch(roads, { /* options */});

var results = match.matchLine(line);

When matching lines, the output is an array of the match results for each coordinate of the line, in the order of the original line coordinates.

output

probematch outputs an array of potential matches, sorted by distance from the probe.

[
  {
    "line": /* the road geometry that matched */,
    "segment": /* the segment of road that matched */,
    "distance":0.004666787054452857
  },
  {
    "segment": /* ... */,
    "line": /* ... */,
    "distance":0.005917207788475857
  }
]

performance

probematch performs best with the smallest road network possible loaded into it's index. Ideally, it is used on a tile-per-tile basis (for example, as part of a tile-reduce job)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.