All Projects β†’ EddyVerbruggen β†’ Nativescript Directions

EddyVerbruggen / Nativescript Directions

Licence: mit
πŸ‘† πŸ‘‰ πŸ‘‡ πŸ‘ˆ Open the Maps app to show directions to anywhere you like

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Nativescript Directions

Nativescript Keyboard Toolbar
βŒ¨οΈπŸ› Add a customizable toolbar on top of the soft keyboard
Stars: ✭ 66 (-18.52%)
Mutual labels:  nativescript
Mapgen2
Map generator for games. Generates island maps with a focus on mountains, rivers, coastlines.
Stars: ✭ 1,188 (+1366.67%)
Mutual labels:  maps
Nativescript Localize
Internationalization plugin for NativeScript using native capabilities of each platform
Stars: ✭ 78 (-3.7%)
Mutual labels:  nativescript
Making Maps With React
🌐 Example React components for React-Leaflet, Pigeon Maps, React MapGL and more
Stars: ✭ 66 (-18.52%)
Mutual labels:  maps
Openmaptiles
OpenMapTiles Vector Tile Schema Implementation
Stars: ✭ 1,175 (+1350.62%)
Mutual labels:  maps
Deck.gl
WebGL2 powered visualization framework
Stars: ✭ 9,304 (+11386.42%)
Mutual labels:  maps
Nativescript Ionic Template
πŸ“± πŸ–₯ Create Mobile First apps, Web and Native sharing the code with Angular πŸŽ‰
Stars: ✭ 65 (-19.75%)
Mutual labels:  nativescript
Nativescript Purchase
πŸ’° A NativeScript plugin for making in-app purchases!
Stars: ✭ 80 (-1.23%)
Mutual labels:  nativescript
Nativescript Speech Recognition
πŸ’¬ Speech to text, using the awesome engines readily available on the device.
Stars: ✭ 72 (-11.11%)
Mutual labels:  nativescript
Nativescript Angular
Integrating NativeScript with Angular
Stars: ✭ 1,203 (+1385.19%)
Mutual labels:  nativescript
Nativescript Dev Appium
A package to help with writing and executing e2e Appium tests in NativeScript apps
Stars: ✭ 69 (-14.81%)
Mutual labels:  nativescript
Editor
An open source visual editor for the 'Mapbox Style Specification'
Stars: ✭ 1,167 (+1340.74%)
Mutual labels:  maps
Vscode Vega Viewer
VSCode extension for Interactive Preview of Vega & Vega-Lite maps πŸ—ΊοΈ & graphs πŸ“ˆ
Stars: ✭ 75 (-7.41%)
Mutual labels:  maps
1843 Planet Generation
One week experiment: learn how to procedurally generate maps on a sphere. Code is messy but it runs.
Stars: ✭ 66 (-18.52%)
Mutual labels:  maps
Examples
Self-contained examples for the legacy Maps API for JavaScript.
Stars: ✭ 78 (-3.7%)
Mutual labels:  maps
Easymap
Ready to use Address Selection Library using Google Maps and Places API.
Stars: ✭ 66 (-18.52%)
Mutual labels:  maps
Mrpt
⚑️ The Mobile Robot Programming Toolkit (MRPT)
Stars: ✭ 1,190 (+1369.14%)
Mutual labels:  maps
Obaddon
A repository of community-built prefabs and other enhancements for Oblige 7.70
Stars: ✭ 81 (+0%)
Mutual labels:  maps
React Native Streetview
React Native Google's Panorama/StreetView component for iOS and Android.
Stars: ✭ 79 (-2.47%)
Mutual labels:  maps
Deep merge
Deep (recursive) merge for maps, keywords and others in Elixir
Stars: ✭ 75 (-7.41%)
Mutual labels:  maps

NativeScript Directions plugin

NPM version Downloads Twitter Follow

⚠️ Looking for NativeScript 7 compatibilty? Go to the NativeScript/plugins repo.

Installation

From the command prompt go to your app's root folder and execute:

tns plugin add nativescript-directions

Usage

Demo app (XML + TypeScript)

Want to dive in quickly? Check out the demo app! Otherwise, continue reading.

You can run the demo app from the root of the project by typing npm run demo.ios.device or npm run demo.android.

Demo app (Angular)

This plugin is part of the plugin showcase app I built using Angular.

API

available

Not all devices have the Google (Android) or Apple (iOS) Maps app installed. Well, most do of course, but on an Android simulator you may be out of luck, so let's check beforehand:

JavaScript
// require the plugin
var Directions = require("nativescript-directions").Directions;

// instantiate the plugin
var directions = new Directions();

directions.available().then(
  function(avail) {
    console.log(avail ? "Yes" : "No");
  }
);
TypeScript
// require the plugin
import { Directions } from "nativescript-directions";

// instantiate the plugin
let directions = new Directions();

directions.available().then(avail => {
    console.log(avail ? "Yes" : "No");
});

navigate

This function opens the native Maps app with a predefined from and to address.

If you don't pass from the current location of the user will be used.

If an address is specified then lat and lng will be ignored.

If you pass in an Array of to addresses, then the last item is the destination, the others become 'waypoints'.

Note that if there's an ocean in between from and to you won't be able to get directions, don't blame this plugin for that 😁

JavaScript
directions.navigate({
  from: { // optional, default 'current location'
    lat: 52.215987,
    lng: 5.282764
  },
  to: { // either pass in a single object or an Array (see the TypeScript example below)
    address: "Hof der Kolommen 34, Amersfoort, Netherlands"
  }
  // for platform-specific options, see the TypeScript example below.
}).then(
  function() {
    console.log("Maps app launched.");
  },
  function(error) {
    console.log(error);
  }
);
TypeScript
directions.navigate({
  from: { // optional, default 'current location'
    lat: 52.215987,
    lng: 5.282764
  },
  to: [{ // if an Array is passed (as in this example), the last item is the destination, the addresses in between are 'waypoints'.
    address: "Hof der Kolommen 34, Amersfoort, Netherlands",
  },
  {
    address: "Aak 98, Wieringerwerf, Netherlands"
  }],
  type: "walking", // optional, can be: driving, transit, bicycling or walking
  ios: {
    preferGoogleMaps: true, // If the Google Maps app is installed, use that one instead of Apple Maps, because it supports waypoints. Default true.
    allowGoogleMapsWeb: true // If waypoints are passed in and Google Maps is not installed, you can either open Apple Maps and the first waypoint is used as the to-address (the rest is ignored), or you can open Google Maps on web so all waypoints are shown (set this property to true). Default false.
  },
  android: {
    newTask: true // Start as new task. This means it will start a new history stack instead of using the current app. Default true.
  }
}).then(() => {
    console.log("Maps app launched.");
}, error => {
    console.log(error);
});

Future work

  • Perhaps add Android-specific options like opening the map in StreetView mode, or pre-defining the transportation type (walk/bike/car).
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].