leaflet-routing
                                
                                
                                
                                    leaflet-routing copied to clipboard
                            
                            
                            
                        Routes on Ocean
Is there a way to calculate route for ships? I mean, given two points on map, calculate shortest (not mandatory) path without touching ground.
Yes, absolutely, but you need to find/make a router backend in order for this to work. I suggest you take a look at https://github.com/pgRouting/pgrouting.
So, is not possible by only using Leaflet to detect ground between two points? Maybe by calculating intercepting geometries on the path?
I don't care about route restrictions, what I only need to know is if there is a way using Leaflet to draw a path between 2 points without touching Ground. Doesn't matter if the calculated path is conceptually wrong for a ship travel, I just need to solve the problem: "Given two points on sea, draw a path wich doesn't touch ground"
No, Leaflet itself does not know what is land and what is water on the map. It only knows about coordinates and how to display items within the grid.
But, is it possible somehow to know given a polygon (a straight line for example, or a triangle), if it has intercepting features?
For example, I could detect geometries that intercepts the line, get their bounds, and re-draw the line so it pass through those bounds.
Is that doable with Leaflet? Thanx in advance.
https://github.com/mehmetalpsumer/leaflet-sea-routes