JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q71671F
  • License ISC

A trackasiagl plugin for the TrackAsia Directions API

Package Exports

  • trackasia-gl-directions
  • trackasia-gl-directions/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (trackasia-gl-directions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.