btrz-map

Library to display a map and live track the position of the bus for a specific trip.

This lib runs in the browser and can be included in any site.

map sample

Prerequisites

  • An account with the premium feature enabled and configured.
  • The scanner app (v7.13.0 or higher) installed on an Android phone to capture the location of the bus.
  • A Betterez public API key.
  • You will need to select a map tiles provider, that is, a provider for the map imagery.

External Dependencies

This lib is built on top of leaftlet so you will need to install leaflet 1.7.1 or compatible.

Installation

Two options:

  • Include the scripts in you HTML file, or
  • via npm install (if using NodeJS)

Include the scripts in your HTML file

  • Include Leaflet CSS file in the head section of your document:

  • Include Leaflet JavaScript file after Leaflet’s CSS:

 
  • Include btrz-map:

 

Via npm install

npm i btrz-map leaflet@1.7.1

With this method you will need to configure your server to find the proper files for each lib.

For btrz-lib, all the files you need are located under node_modules/btrz-map/dist

For leaflet, all the files you need are located under node_modules/leaflet/dist

Usage

...

    ...
    //Make sure to provide at least a height for the map container
    


    ...
    

...

Note: Only one trip at a time is allowed on the map.

API

Please check the API docs

Contributing as a developer

Run test

npm test

Generate API docs

Only if you modified some JSDocs. It reads the JSDocs and generate MD doc file under docs/API.md.

npm run generate-docs

Build

npm run build

Push a new version

npm version [major || minor || patch]