trackasia-gl-directions

4.3.0 • Public • Published

TrackAsia GL Directions

A full featured directions plugin for TrackAsia GL JS using the TrackAsia Directions API. Quickly add UI to display driving, cycling, or walking directions on the map. The TrackAsia Directions API is powered by the OSRM routing engine and open data from the OpenStreetMap project.

For directions functionality in native mobile and desktop applications, see TrackAsia Android Services, TrackAsiaDirections.swift, TrackAsiaNavigation IOS, TrackAsiaNavigation Android

Installation

npm install trackasiagl --save # if not already installed
npm install trackasia-gl-directions --save

Usage

  • CommonJS
var trackasiagl = require('trackasia-gl');
var TrackAsiaDirections = require('trackasia-gl-directions');

var directions = new TrackAsiaDirections({
  unit: 'metric',
  profile: 'drive'
});

var map = new trackasiagl.Map({
  container: 'map',
  style: 'https://tiles.track-asia.com/tiles/v1/style-streets.json?key=public'
});

map.addControl(directions, 'top-left');
  • ESM
import trackasiagl from 'trackasia-gl';
import TrackAsiaDirections from 'trackasia-gl-directions/dist/trackasia-gl-directions';
import 'trackasia-gl/dist/trackasia-gl.css';
import 'trackasia-gl-directions/dist/trackasia-gl-directions.css';

var directions = new TrackAsiaDirections({
  unit: 'metric',
  profile: 'drive'
});

var map = new trackasiagl.Map({
  container: 'map',
  style: 'https://tiles.track-asia.com/tiles/v1/style-streets.json?key=public'
});

map.addControl(directions, 'top-left');

Live example: https://docs.track-asia.com/example/direction-between-two-points/

Flow publish to npm

  • B1: Build the project and skip warning redux in production:
      npm run prepublish
  • B2: Pusblish to npm. Note: check version again. Example current version: 4.1.9 after publishing it is 4.2.0
      npm run publish

Deeper dive

See API.md for complete reference.

Contributing

See CONTRIBUTING.md.

Package Sidebar

Install

npm i trackasia-gl-directions

Weekly Downloads

6

Version

4.3.0

License

ISC

Unpacked Size

449 kB

Total Files

48

Last publish

Collaborators

  • advnsoftware
  • david_roark
  • minhnhutdev