leaflet-routing

Leaflet.Routing is a routing controller for the popular Leaflet mapping framework. The module provides an intuitive interface for routing paths between waypoints using any user specified routing service.

  • 所有者: Turistforeningen/leaflet-routing
  • 平台:
  • 許可證: BSD 2-Clause "Simplified" License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Leaflet.Routing

![Gitter](https://badges.gitter.im/Join Chat.svg)

Leaflet.Routing is a routing controller for the popular Leaflet mapping
framework. The module provides an intuitive interface for routing paths between
waypoints using any user specified routing service. A demo using the OSM data
can be found
here.

Prototype Routing using Leaflet

Features

  • Route handling interface for Leaflet
  • Use your own routing backend, or OSM

Usage

var routing = new L.Routing({
  position: 'topright'
  ,routing: {
    router: myRouterFunction
  }
  ,tooltips: {
    waypoint: 'Waypoint. Drag to move; Click to remove.',
    segment: 'Drag to create a new waypoint'
  }
  ,styles: {     // see http://leafletjs.com/reference.html#polyline-options
    trailer: {}  // drawing line
    ,track: {}   // calculated route result
    ,nodata: {}  // line when no result (error)
  }
  ,snapping: {
    layers: [mySnappingLayer]
    ,sensitivity: 15
    ,vertexonly: false
  }
  ,shortcut: {
    draw: {
      enable: 68    // 'd'
      ,disable: 81  // 'q'
    }
  }
});
map.addControl(routing);

Enable Drawing

routing.draw(true);

Enable Routing NOT IMPLEMENTED

routing.routing(true);

Enable Snapping NOT IMPLEMETED

routing.snapping(true);

Recalculate the complete route by routing each segment

routing.rerouteAllSegments(callback);

Get first waypoint

var first = routing.getFirst();

Get last waypoint

var last = routing.getLast();

Get all waypoints

var waypointsArray = routing.getWaypoints();

Routing to Polyline

var polyline = routing.toPolyline();

To GeoJSON

var geoJSON3D = routing.toGeoJSON();
var geoJSON2D = routing.toGeoJSON(false);

Load GeoJSON

Load GeoJSON with and without properties.waypoints.

Options

  • number waypointDistance - distance between inserted waypoints for GeoJSON without waypoints.
  • boolean fitBounds - fit map arround loaded GeoJSON.
routing.loadGeoJSON(geojson, [options], function(err) {
  if (err) {
    console.log(err);
  } else {
    console.log('Finished loading GeoJSON');
  }
});

Events

All events form Leaflet.Routing is prefixed with routing:.

Usage

routing.on('routing:someEvent', function() {
  console.log('routing:someEvent triggered');
});

Copyright (c) 2014, Den Norske Turistforening

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions
    and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
    and the following disclaimer in the documentation and/or other materials provided with the
    distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

主要指標

概覽
名稱與所有者Turistforeningen/leaflet-routing
主編程語言JavaScript
編程語言CSS (語言數: 3)
平台
許可證BSD 2-Clause "Simplified" License
所有者活动
創建於2013-05-28 15:06:18
推送於2021-06-27 08:56:58
最后一次提交
發布數3
最新版本名稱v0.1.1 (發布於 2014-03-11 16:03:42)
第一版名稱0.0.2 (發布於 2013-06-24 11:29:22)
用户参与
星數269
關注者數21
派生數67
提交數170
已啟用問題?
問題數41
打開的問題數20
拉請求數7
打開的拉請求數4
關閉的拉請求數1
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?