Giter Site home page Giter Site logo

jgravois / lrm-esri Goto Github PK

View Code? Open in Web Editor NEW
25.0 6.0 9.0 3.09 MB

use Esri's hosted routing service in Leaflet to generate walk, car and truck routes/directions

License: Apache License 2.0

JavaScript 100.00%
leaflet leaflet-routing-machine esri directions

lrm-esri's Introduction

Leaflet Routing Machine - Esri plugin

enables walk, drive and truck routing using Esri's hosted service.

Demo

Check out the live demo.

Usage

animation

<script src="./lrm-esri.js"></script>
/*
additional profiles:
Walking, Trucking, Rural Driving, Walking Distance, Trucking Distance, Driving Distance and Rural Driving Distance
*/
var control = L.Routing.control({
	router: L.Routing.esri({
    liveTraffic: true,
    profile: 'Driving'
  })
}).addTo(map);

Features

Esri's hosted routing service can find the shortest driving, truck and walk time or distance for up to 150 input stops. It is able to incorporate both live and historic traffic and can reorder input stops to find the optimal sequence.

Authentication

Use a proxied service

You can allow anonymous users to get directions in your application by leveraging a proxied service - live demo

  1. Sign up for a free developer account
  2. Create your own proxied service url
  3. supply the url in the provider constructor
var control = L.Routing.control({
  router: L.Routing.esri({
    url: '<your proxied service url>'
  })
}).addTo(map);

When credentials are embedded, 1250 requests/month are provided for free. Deployment packs are available to help you scale.

Use OAuth2

You can also use OAuth2 and bill routing charges directly to existing ArcGIS users - live demo

  1. Sign up for a free developer account
  2. Create and register a new application
  3. Reference your clientID in your app and configure a redirectUri
  4. after the user signs in, supply their token in the provider constructor (more info here)
var control = L.Routing.control({
  router: L.Routing.esri({
    token: '<user token>'
  })
}).addTo(map);

Development Instructions

If you'd like to inspect and modify the source code, follow the instructions below to set up a local development environment.

  1. Fork and clone
  2. cd into the lrm-esri folder
  3. Install the package.json dependencies by running npm install
  4. Run npm start from the command line. This will recompile minified source in the dist directory, launch a tiny webserver and begin watching the raw source for changes.
  5. Run http://localhost:8080/examples/index.html to check out your changes
  6. Create a pull request

Dependencies

  • leaflet
  • leaflet-routing-machine
  • cors-lite
  • esri-leaflet

Resources

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

Caveats

Many Esri routing service features have not been implemented

  • barriers
  • route optimization
  • driving, trucking and walking distance
  • time windows
  • routing for emergency vehicles

Licensing

Copyright © 2017 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's LICENSE file.

lrm-esri's People

Contributors

jgravois avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

lrm-esri's Issues

remove 'Height Restriction'

lrm-esri/src/esriRouter.js

Lines 351 to 353 in 5f82e3d

if (this.options.vehicleHeight) {
completeServiceUrl += "&restrictionAttributeNames=Height Restriction&attributeParameterValues=[{'attributeName': 'Height Restriction','parameterName': 'Vehicle Height (meters)','value': " + this.options.vehicleHeight + '}]';
}

i helped a user on Slack the other day and quickly stubbed in support for a new constuctor option called vehicleHeight which expects a number in meters.

this should be removed for two reasons

  1. travelMode trumps external attribute restrictions
  2. setting just one new restrictionAttributeNames wipes out the defaults (and leads to strange solutions)
Avoid Carpool Roads, Avoid Express Lanes, Avoid Gates, Avoid Private Roads, Avoid Unpaved Roads, Driving an Automobile, Roads Under Construction Prohibited, Through Traffic Prohibited.

http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Route_service_with_synchronous_execution/02r300000036000000/

Can the results of Network Analysis display as Leaflet Routing Machine style ?

Hello !
I'm trying to show the results of Network Analysis(VRP) in the style of Leaflet Routing Machine, as shown in the figure, but I don't know how. I wonder if this can be achieved ?
345

I really appreciate if you can give me some suggestions or example that solves this.
Sorry for the inconveniences and thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.