Closed stefanocudini closed 5 years ago
@stefanocudini sure - can you help me understand how to proceed?
I would like to support all the services you have published on the KeplerJs platform as they are very useful!
Referring to this issue https://github.com/GIScience/openrouteservice-js/issues/4
in the meantime I managed to make only the directions module work, but the other modules that connect to services
I think that at present the management of the modules is not commojs compatible and therefore can not be easily included in a nodejs project like this
it should be possible to expose all modules simply by including an index.js file in the repository root (specified in the main: in package.json field) without having to know the path of the files to be included.
in this specific case, I am forced to specify the complete path:
var baseDir = 'openrouteservice-js/src/';
var Directions = Npm.require(baseDir+'OrsDirections');
but the standard behaviour should be this:
var OrsJs = Npm.require('openrouteservice-js');
and the other modules should be accessible with this OrsJs object
@stefanocudini could you please try version 0.0.2 ?
const Ors = require('openrouteservice-js')
var Directions = new Ors.Directions({
api_key: "XY"
});
Directions.calculate({
coordinates: [[8.690958, 49.404662], [8.687868, 49.390139]],
profile: "driving-car",
extra_info: ["waytype", "steepness"],
geometry_format:"encodedpolyline",
format: "json",
mime_type: "application/json"
})
.then(function(response) {
console.log("response", response);
})
.catch(function(err) {
var str = "An error occured: " + err;
console.log(str);
});
many tnks @TimMcCauley from the Kepler version 1.6.2 this plugin import the module v0.0.2 and all works well. https://github.com/Keplerjs/keplerjs-openrouteservice/blob/master/package.js#L11
@stefanocudini you are welcome and thank you for using ors!!
in version 0.0.9 mi import works.. but I have other issue with geojson format, look here: https://github.com/GIScience/openrouteservice-js/issues/13
asking support to @TimMcCauley for integrate client side ors api
https://github.com/GIScience/openrouteservice-js