getWorldWidth method
Returns the width of the world in geometry coordinates.
Is used at least in 2 cases:
- my polyline crosses longitude 180, and I somehow need to "add a world" to the coordinates in order to display a continuous polyline
- when my map scrolls around longitude 180 and I have a marker in this area, the marker may be projected a world away, depending on the map being centered either in the 179 or the -179 part - again, we can "add a world"
Implementation
double getWorldWidth() {
final (x0, _) = projectXY(const LatLng(0, 0));
final (x180, _) = projectXY(const LatLng(0, 180));
return 2 * (x0 > x180 ? x0 - x180 : x180 - x0);
}