Skip to content

nexogen-international/Leaflet.Routing.Nexogen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Leaflet Routing Machine plugin for NEXOGEN GIS Routing API v2.

The package contains:

Plug-in for integration with

  • NEXOGEN GIS Routing API v2

Plug-in was tested with the following dependencies:

  • Leaflet 1.5.1+
  • Leaflet Routing Machine 3.2.12+

You must use NEXOGEN GIS Routing API either via a local CORS proxy or your dedicated backend API to avoid CORS issues.

Usage:

To test the plug-in locally, you need to use a local CORS proxy first. One suggestion is to install local-cors-proxy via npm.

npm install -g local-cors-proxy
lcp https://{api_url_placeholder}

where {api_url_placeholder} is your URL referring to your designated NEXOGEN GIS API endpoint.

The plug-in can be used in the following way:

L.Routing.control({
	addWaypoints: true,
	waypoints: [
		L.latLng(47.46072, 18.95798),
		L.latLng(46.2530102, 20.1414253)
	],
	router: L.Routing.nexogen({
		baseUrl: 'http://localhost:8010/proxy', // url to local-cors-proxy or backend API on the same domain to avoid CORS issues
		bearerToken: '{api_token_placeholder}',
		vehicleProfile: 'Truck_40t', // Car, etc.
	}),
	lineOptions: {
		styles: [
			{ color: '#0000F0', opacity: 0.5, weight: 7 }
		]
	}
}).addTo(map);

About

A leaflet-routing-machine plugin for NEXOGEN GIS and routing API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published