Open NiekRood opened 6 years ago
Monique,
I apologize for not getting back to you sooner. We're in the process of moving and my time has been very limited lately.
The first error ( L.Routing.OpenRouteService.js:52 Uncaught ReferenceError: corslite is not defined) is most likely because the corslite dependency is not satisfied. I regret that the plugin I wrote is not NodeJS-friendly or Browserify-friendly at this point. Here is the script portion of the index.html file I used during development, which includes the corslite dependency:
<script src=" file:///home/jim/code-workspace/routing/node_modules/haversine/haversine.js"
Using npm, you can install the dependencies, and then just include them in your HTML file. That should resolve the issue. If not, please let me know.
The second error is odd. I just did a quick test and I can see the linestrings for the routes built. However, I am using the OSRM application itself on my machine and not pointing to the 'Net. That could be one reason. Another possibility is the corslite dependency is fouling the ability to show the route properly.
My suggestion is to see if the first issue is fully resolved first (the error is eliminated and no longer present in the web browser's console). If the second issue is still present, if possible, send me your code and I can test on my end to see what may be happening.
Again, my apologies for not getting back to you sooner and please let me know how you make out.
On Thu, Mar 15, 2018 at 2:55 AM, NiekRood notifications@github.com wrote:
Goodday,
Yersterday I asked the owner of Leaflet Routing Machine if LRM also supports openrouteservice (see my question asked here perliedman/leaflet-routing-machine#469 https://github.com/perliedman/leaflet-routing-machine/issues/469)
He guided me to you . I am using your plugin, but I encouter different issues. First one is the following error code: L.Routing.OpenRouteService.js:52 Uncaught ReferenceError: corslite is not defined
Second, there is no polyline on the map. I see two markers, but that's it. The json response I get from openrouteservice is fine
{"routes":[{"summary":{"distance":1735.7,"duration": 1249.7},"geometry_format":"geojson","geometry":{"type":" LineString","coordinates":[[5.27243,51.507831],[5.2729,51. 50848],[5.273059,51.508697],[5.273288,51.50901],[5.273051, 51.509192],[5.272982,51.509256],[5.27288,51.50922],[5. 27266,51.50919],[5.27078,51.50948],[5.26992,51.50965],[5. 26971,51.50971],[5.26957,51.50977],[5.26932,51.50993],[5. 26835,51.51122],[5.26758,51.51234],[5.26751,51.51248],[5. 26744,51.51278],[5.26729,51.51437],[5.26735,51.51458],[5. 267655,51.51506],[5.267966,51.515404],[5.268613,51.516091],[ 5.268636,51.516109],[5.268761,51.516208],[5.268711,51. 516298],[5.268831,51.516565],[5.268837,51.516691],[5.268638, 51.517146],[5.26852,51.517383],[5.268219,51.517677],[5. 26828,51.51865],[5.267989,51.518671],[5.26753,51.51893],[5. 26751,51.51897],[5.267574,51.519126],[5.267772,51.519594],[ 5.267622,51.519621],[5.266814,51.519725],[5.26687,51.519818] ,[5.266901,51.519871],[5.26692,51.519902],[5.266911,51. 519946],[5.266868,51.519973],[5.266699,51.520025]]}," segments":[{"distance":1735.7,"duration":1249.7,"steps":[{" distance":143.9,"duration":103.6,"type":11,"instruction":"Richting noordoost op Groenewoud","name":"Groenewoud","way_points":[0,3] },{"distance":34.6,"duration":24.9,"type":0,"instruction":"Keer om links","name":"","way_points":[3,5]},{"distance":1198.2," duration":862.7,"type":0,"instruction":"Doorgaan links richting Beerseveld","name":"Beerseveld","way_points":[5,29]},{"distance":108.3," duration":77.9,"type":5,"instruction":"Keer om flauw rechts","name":"","way_points":[29,30]},{"distance":63.1," duration":45.4,"type":0,"instruction":"Keer om links richting Watermolenweg","name":"Watermolenweg","way_points":[ 30,32]},{"distance":76.4,"duration":55,"type":5,"instruction":"Keer om flauw rechts richting Watermolenweg","name":"Watermolenweg","way_points":[ 32,35]},{"distance":67.9,"duration":48.9,"type":0,"instruction":"Keer om links richting Spoordonkseweg","name":"Spoordonkseweg","way_points":[ 35,37]},{"distance":21.1,"duration":15.2,"type":1,"instruction":"Keer om rechts richting Spoordonkseweg","name":"Spoordonkseweg","way_points":[ 37,40]},{"distance":22.3,"duration":16,"type":4,"instruction":"Keer om flauw links richting Spoordonkseweg","name":" Spoordonkseweg","way_points":[40,43]},{"distance":0," duration":0,"type":10,"instruction":"Arrive at Spoordonkseweg, on the left","name":"","way_points":[43,43]}]}],"way_points":[0,43] ,"bbox":[5.266699,51.507831,5.273288,51.520025]}],"bbox":[5. 266699,51.507831,5.273288,51.520025],"info":{"attribution":" openrouteservice.org | OpenStreetMap contributors","osm_file_md5_hash":" 00dbdb64edfeaad82649a77d599421a7","engine":{"version":"4.4. 0","build_date":"2018-02-27T14:24:56Z"},"service":"routing","timestamp": 1521092165977,"query":{"profile":"foot-walking"," preference":"recommended","coordinates":[[5.275272,51. 507033],[5.2666,51.5199]],"language":"nl","units":"m"," geometry":true,"geometryformat":"geojson","geometry simplify":false,"instructions_format":"text","instructions": true,"elevation":false}}}
Regards,, Monique
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/willmorejg/lrm-openrouteservice/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBR3vhIwIv2HaFY8tVpeh3wVOvdFOFkks5tehBwgaJpZM4SrpD9 .
Jim
========== Sent using GMail account
Ugh. I feel a bit stupid for the last reply regarding the use of OSRM - not related to the question you asked.
I reverified the behavior using OpenRouteService and was able to reproduce the issue you are having by using an invalid API key. Using a valid API key, I can see the lisestrings. I am not saying this is the issue, because you appear to be getting a valid response back from OpenRouteService. But I do suspect that something with the rendering of the response related to the first issue you experienced is playing a part in the second issue.
If you continue to experience issues, please provide the code you are using (MINUS ANY API KEYS, PASSWORDS, ETC.) so I can try on my end to reproduce / troubleshoot.
With invalid API key:
With valid API key
On Sun, Mar 18, 2018 at 4:44 AM, James Willmore willmorejg@gmail.com wrote:
Monique,
I apologize for not getting back to you sooner. We're in the process of moving and my time has been very limited lately.
The first error ( L.Routing.OpenRouteService.js:52 Uncaught ReferenceError: corslite is not defined) is most likely because the corslite dependency is not satisfied. I regret that the plugin I wrote is not NodeJS-friendly or Browserify-friendly at this point. Here is the script portion of the index.html file I used during development, which includes the corslite dependency:
Using npm, you can install the dependencies, and then just include them in your HTML file. That should resolve the issue. If not, please let me know.
The second error is odd. I just did a quick test and I can see the linestrings for the routes built. However, I am using the OSRM application itself on my machine and not pointing to the 'Net. That could be one reason. Another possibility is the corslite dependency is fouling the ability to show the route properly.
My suggestion is to see if the first issue is fully resolved first (the error is eliminated and no longer present in the web browser's console). If the second issue is still present, if possible, send me your code and I can test on my end to see what may be happening.
Again, my apologies for not getting back to you sooner and please let me know how you make out.
On Thu, Mar 15, 2018 at 2:55 AM, NiekRood notifications@github.com wrote:
Goodday,
Yersterday I asked the owner of Leaflet Routing Machine if LRM also supports openrouteservice (see my question asked here perliedman/leaflet-routing-machine#469 https://github.com/perliedman/leaflet-routing-machine/issues/469)
He guided me to you . I am using your plugin, but I encouter different issues. First one is the following error code: L.Routing.OpenRouteService.js:52 Uncaught ReferenceError: corslite is not defined
Second, there is no polyline on the map. I see two markers, but that's it. The json response I get from openrouteservice is fine
{"routes":[{"summary":{"distance":1735.7,"duration":1249.7}, "geometry_format":"geojson","geometry":{"type":"LineString" ,"coordinates":[[5.27243,51.507831],[5.2729,51.50848],[5. 273059,51.508697],[5.273288,51.50901],[5.273051,51.509192] ,[5.272982,51.509256],[5.27288,51.50922],[5.27266,51. 50919],[5.27078,51.50948],[5.26992,51.50965],[5.26971,51. 50971],[5.26957,51.50977],[5.26932,51.50993],[5.26835,51. 51122],[5.26758,51.51234],[5.26751,51.51248],[5.26744,51. 51278],[5.26729,51.51437],[5.26735,51.51458],[5.267655,51. 51506],[5.267966,51.515404],[5.268613,51.516091],[5.268636, 51.516109],[5.268761,51.516208],[5.268711,51.516298],[ 5.268831,51.516565],[5.268837,51.516691],[5.268638,51. 517146],[5.26852,51.517383],[5.268219,51.517677],[5.26828, 51.51865],[5.267989,51.518671],[5.26753,51.51893],[5.26751, 51.51897],[5.267574,51.519126],[5.267772,51.519594],[5. 267622,51.519621],[5.266814,51.519725],[5.26687,51.519818],[ 5.266901,51.519871],[5.26692,51.519902],[5.266911,51.519946 ],[5.266868,51.519973],[5.266699,51.520025]]},"segments" :[{"distance":1735.7,"duration":1249.7,"steps":[{"di stance":143.9,"duration":103.6,"type":11,"instruction":"Richting noordoost op Groenewoud","name":"Groenewoud","way_points":[0,3]},{" distance":34.6,"duration":24.9,"type":0,"instruction":"Keer om links","name":"","way_points":[3,5]},{"distance":1198.2,"dur ation":862.7,"type":0,"instruction":"Doorgaan links richting Beerseveld","name":"Beerseveld","way_points":[5,29]},{" distance":108.3,"duration":77.9,"type":5,"instruction":"Keer om flauw rechts","name":"","way_points":[29,30]},{"distance":63.1,"du ration":45.4,"type":0,"instruction":"Keer om links richting Watermolenweg","name":"Watermolenweg","way_points":[30,32]}, {"distance":76.4,"duration":55,"type":5,"instruction":"Keer om flauw rechts richting Watermolenweg","name":"Watermo lenweg","way_points":[32,35]},{"distance":67.9,"duration": 48.9,"type":0,"instruction":"Keer om links richting Spoordonkseweg","name":"Spoordonkseweg","way_points":[35,37] },{"distance":21.1,"duration":15.2,"type":1,"instruction":"Keer om rechts richting Spoordonkseweg","name":"Spoord onkseweg","way_points":[37,40]},{"distance":22.3,"duration": 16,"type":4,"instruction":"Keer om flauw links richting Spoordonkseweg","name":"Spoordonkseweg","way_points":[40,43] },{"distance":0,"duration":0,"type":10,"instruction":"Arrive at Spoordonkseweg, on the left","name":"","way_points":[ 43,43]}]}],"way_points":[0,43],"bbox":[5.266699,51.507831,5. 273288,51.520025]}],"bbox":[5.266699,51.507831,5.273288,51.5 20025],"info":{"attribution":"openrouteservice.org | OpenStreetMap contributors","osm_file_md5_hash":"00dbdb64edfeaad82649a77d5 99421a7","engine":{"version":"4.4.0","build_date":"2018-02-2 7T14:24:56Z"},"service":"routing","timestamp":1521092165977, "query":{"profile":"foot-walking","preference":" recommended","coordinates":[[5.275272,51.507033],[5.2666, 51.5199]],"language":"nl","units":"m","geometry":true," geometry_format":"geojson","geometry_simplify":false," instructions_format":"text","instructions":true,"elevation":false}}}
Regards,, Monique
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/willmorejg/lrm-openrouteservice/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBR3vhIwIv2HaFY8tVpeh3wVOvdFOFkks5tehBwgaJpZM4SrpD9 .
--
Jim
========== Sent using GMail account
Jim
========== Sent using GMail account
Hi James,
Thank you for your response. The problems had to do with three missing files. (thanks for showing your index.html)
https://cdn.jsdelivr.net/npm/lodash@4.17.5/lodash.min.js https://cdn.jsdelivr.net/npm/@mapbox/corslite@0.0.7/corslite.min.js https://cdn.jsdelivr.net/npm/polyline@0.2.0/src/polyline.min.js
I made a reference to the above files and now everything is working . The missing polyline had to do with polyline.min.js. (I don't know why this plugin is needed?)
Good luck with moving!!
Great to hear and thank you!
On Sun, Mar 18, 2018 at 5:57 AM, NiekRood notifications@github.com wrote:
Hi James,
Thank you for your response. The problems had to do with three missing files. (thanks for showing your index.html)
https://cdn.jsdelivr.net/npm/lodash@4.17.5/lodash.min.js https://cdn.jsdelivr.net/npm/@mapbox/corslite@0.0.7/corslite.min.js https://cdn.jsdelivr.net/npm/polyline@0.2.0/src/polyline.min.js
I made a reference to the above files and now everything is working . The missing polyline had to do with polyline.min.js. (I don't know why this plugin is needed?)
Good luck with moving!!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/willmorejg/lrm-openrouteservice/issues/1#issuecomment-373985676, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBR3r3_Dh4cDh77EpMO6TOvUBXAy38qks5tfi-ngaJpZM4SrpD9 .
Jim
========== Sent using GMail account
Hi @NiekRood, @willmorejg , do you know how to solve this issue?
ERROR TypeError: L.Routing.openrouteservice is not a constructor
i already include the script into my project.
I added the three files listed above to solve the corslite issue. Thanks for this.
I am using a self-hosted OpenRouteService and up to now I have not looked into how one sets an api key. So I simply used a blank key and everything worked first time. To be clear, I set the router as follows
router: new L.Routing.openrouteservice('')
Many thanks for the excellent work.
For Gérald Niel's equivalent Leaflet Routing Machine - OpenRoute Service
https://framagit.org/gegeweb/leaflet-routing-machine-openroute/
I tried setting my ORS service in his leaflet-routing-openroute.js but this did not work. I'll try initialising the router in the main script using:
const osrRouter = ..... router: osrRouter,
as he describes.
Goodday,
Yersterday I asked the owner of Leaflet Routing Machine if LRM also supports openrouteservice (see my question asked here https://github.com/perliedman/leaflet-routing-machine/issues/469)
He guided me to you . I am using your plugin, but I encouter different issues. First one is the following error code: L.Routing.OpenRouteService.js:52 Uncaught ReferenceError: corslite is not defined
Second, there is no polyline on the map. I see two markers, but that's it. The json response I get from openrouteservice is fine
{"routes":[{"summary":{"distance":1735.7,"duration":1249.7},"geometry_format":"geojson","geometry":{"type":"LineString","coordinates":[[5.27243,51.507831],[5.2729,51.50848],[5.273059,51.508697],[5.273288,51.50901],[5.273051,51.509192],[5.272982,51.509256],[5.27288,51.50922],[5.27266,51.50919],[5.27078,51.50948],[5.26992,51.50965],[5.26971,51.50971],[5.26957,51.50977],[5.26932,51.50993],[5.26835,51.51122],[5.26758,51.51234],[5.26751,51.51248],[5.26744,51.51278],[5.26729,51.51437],[5.26735,51.51458],[5.267655,51.51506],[5.267966,51.515404],[5.268613,51.516091],[5.268636,51.516109],[5.268761,51.516208],[5.268711,51.516298],[5.268831,51.516565],[5.268837,51.516691],[5.268638,51.517146],[5.26852,51.517383],[5.268219,51.517677],[5.26828,51.51865],[5.267989,51.518671],[5.26753,51.51893],[5.26751,51.51897],[5.267574,51.519126],[5.267772,51.519594],[5.267622,51.519621],[5.266814,51.519725],[5.26687,51.519818],[5.266901,51.519871],[5.26692,51.519902],[5.266911,51.519946],[5.266868,51.519973],[5.266699,51.520025]]},"segments":[{"distance":1735.7,"duration":1249.7,"steps":[{"distance":143.9,"duration":103.6,"type":11,"instruction":"Richting noordoost op Groenewoud","name":"Groenewoud","way_points":[0,3]},{"distance":34.6,"duration":24.9,"type":0,"instruction":"Keer om links","name":"","way_points":[3,5]},{"distance":1198.2,"duration":862.7,"type":0,"instruction":"Doorgaan links richting Beerseveld","name":"Beerseveld","way_points":[5,29]},{"distance":108.3,"duration":77.9,"type":5,"instruction":"Keer om flauw rechts","name":"","way_points":[29,30]},{"distance":63.1,"duration":45.4,"type":0,"instruction":"Keer om links richting Watermolenweg","name":"Watermolenweg","way_points":[30,32]},{"distance":76.4,"duration":55,"type":5,"instruction":"Keer om flauw rechts richting Watermolenweg","name":"Watermolenweg","way_points":[32,35]},{"distance":67.9,"duration":48.9,"type":0,"instruction":"Keer om links richting Spoordonkseweg","name":"Spoordonkseweg","way_points":[35,37]},{"distance":21.1,"duration":15.2,"type":1,"instruction":"Keer om rechts richting Spoordonkseweg","name":"Spoordonkseweg","way_points":[37,40]},{"distance":22.3,"duration":16,"type":4,"instruction":"Keer om flauw links richting Spoordonkseweg","name":"Spoordonkseweg","way_points":[40,43]},{"distance":0,"duration":0,"type":10,"instruction":"Arrive at Spoordonkseweg, on the left","name":"","way_points":[43,43]}]}],"way_points":[0,43],"bbox":[5.266699,51.507831,5.273288,51.520025]}],"bbox":[5.266699,51.507831,5.273288,51.520025],"info":{"attribution":"openrouteservice.org | OpenStreetMap contributors","osm_file_md5_hash":"00dbdb64edfeaad82649a77d599421a7","engine":{"version":"4.4.0","build_date":"2018-02-27T14:24:56Z"},"service":"routing","timestamp":1521092165977,"query":{"profile":"foot-walking","preference":"recommended","coordinates":[[5.275272,51.507033],[5.2666,51.5199]],"language":"nl","units":"m","geometry":true,"geometry_format":"geojson","geometry_simplify":false,"instructions_format":"text","instructions":true,"elevation":false}}}
Regards,, Monique