Drawing a line across the separation meridian

22 views
Skip to first unread message

Ciprian Sufitchi

unread,
Oct 27, 2016, 12:48:23 AM10/27/16
to Leaflet
Hello,

I am new at Leaflet. I want to draw all sort of polylines on a map and some of them would cross the imaginary Date Line meridian. I see the line connected to the opposite point, which theoretically is correct, but I need the short path.
Example:

    var coord = [
    [40, 179],
    [40, -179]
];
    var polyline = L.polyline(coord, {color: 'red', weight: 1}).addTo(map);

I dont want the line to cross all the globe (long path), the connection between those 2 points must be short, only 2 degrees long.

Is there a Map option to achieve that?

Thanks,
Chip

Ciprian Sufitchi

unread,
Dec 14, 2016, 1:16:20 PM12/14/16
to Leaflet
Nu reply yet.  :(

Meanwhile I saw complaints about this lack of functionality submitted for a couple of years, but this was never addressed.
To me, being able to dray a line that crosses the seapration meridian on the short path as opposed to long path, is quite a basic function.
I implemented code to work around this problem, but I really hope someone will look into it.

Thanks,
Chip
Reply all
Reply to author
Forward
0 new messages