0.1.0 • Published 9 years ago

mapbox-map-matching.js v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

Build Status

mapbox-map-matching.js

Mapbox.js plugin to match input geojson geometries to perfectly align with the openstreetmap streets using the Mapbox Map Matching API.

Installation

Inlcude mapbox-map-matching.js after Mapbox.js in your html.

From Mapbox Plugins CDN:

<script src='//api.tiles.mapbox.com/mapbox.js/plugins/mapbox.map-matching.js/v0.2.0/mapbox.map-matching.min.js'></script>

Or download the js files from the dist directory.

example

L.mapbox.mapmatching(geojson, options, function (error, layer) {
    layer.addTo(map);
    layer.setStyle({
        color: '#9a0202',
        weight: 4,
        opacity: 0.8
    });
});

API

options

  • profile to be used for mapmatching
  • :car (default) for matching to motorable roads
  • :foot for matching to pedestrian streets and footpaths
  • mapmatchAPI : Custom API endpoint for mapmatching
  • gpsPrecision : Integer indicating the precision of the input geometries in metres (default=5)
  • return type of object to return after matching
  • :layer (default) returns a leaflet featureLayer
  • :geojson returns a geojson feature collection

Development

This is a browserify project:

git clone git@github.com:mapbox/mapbox-map-matching.js.git
cd mapbox-map-matching.js
npm install
npm run build

mapbox-map-matching.js and mapbox-map-matching.min.js are built files generated from index.js by browserify. If you find an issue, it either needs to be fixed in index.js, or in one of the libraries mapbox-mapmatch uses to parse formats.