osrm-frontend.js options need documenting
I can't seem to find any documentation on the options in osrm-frontend.js, and several things are unclear:
-
layerandbaselayerseem to be partially duplicated, but the meaning of each is unclear, and the ordering given in either does not reflect what appears online. -
It is unclear how to set the default tile layer. Setting this in
defaultView.layerdoesn't seem to take effect, even after a rebuild. -
servicesimplies a set of definitions, but none ever appears in the interface as far as I can tell. -
overlayrefers to small_components (whose purpose is not documented) but it is not clear if no overlays (again, not clear what these are intended to be) are wanted.
Would someone kindly be add some comments to the template of this file, so that these become clear?
(In the meanwhile, if anyone can clarify the above on this thread that would also be useful!)
To answer my own question 3, the code has:
serviceUrl: leafletOptions.services[0].path
which seems to show that only the first is ever used, if there is more than one.
it's confusing because there is different JS running in the public demo instance at http://map.project-osrm.org . There the different services are available at the bottom left of where you type the address. I assume these are extra entries in the services array in leaflet-options.js. If you look in dev tools, on line 1500 inside the onAdd function, it's adding the services like this:
for (var s = 0, d = this.options.services.length; s < d; s++) {
var l;
l = n.DomUtil.create("option", "", a),
l.setAttribute("value", "" + s),
l.innerHTML = this.options.services[s].label
}
n.DomEvent.addListener(a, "change", function() {
a.selectedIndex >= 0 && a.selectedIndex < o.length && (n.Util.setOptions(r,
{
serviceUrl: o[a.selectedIndex].path,
fixspeed: o[a.selectedIndex].fixspeed
}),
this.setWaypoints(this.getWaypoints()))
}, this)
None of that code appears anywhere in the src/ folder javascript inside the git repo here, but it's running on the public demo instance. It's seems like it's two different versions of the code.