
The 180th Meridian (2016) - Tomte
https://macwright.org/2016/09/26/the-180th-meridian.html
======
ThisIsTheWay
It's wild to see something so obscure - yet so relevant to my work - on the
front page of HN. The antimeridian problem has plagued the GIS and satellite
imaging communities for years, and as the article illustrates, there is no
simple solution.

------
lalaithion
I don't really see the point of this post.

Any two points on the earth are connected by a great circle. The two points
divide the great circle into two arcs. The length of the shorter arc is the
distance between them. The midpoint of the two points is half the distance
between them along the shorter arc starting from one point.

Are any of the values above particularly expensive to compute? I can't imagine
why I'd want to compute the midpoint between two points by averaging their
latitudes and longitudes. Not only does it break if it travels over the prime
meridian, but it's also just wrong. The post even says that: "But is the
midpoint in longitude, latitude correct? In many cases, it isn’t."

~~~
apendleton
Explaining it in terms of points and distances is an effort at making the
content accessible, but the issues arise when you're dealing with complex
shapes, which might not be able to be unambiguously represented: given a
sequence of points representing a polygon, it will not always the case that
the shorter line connecting two points is the intended one, for example. And
it's possible to contrive examples where you have two such shapes, where if
you assume that each consecutive pair of points signifies an edge that's the
shortest possible line between those two points, and then you naively
calculate the intersection of those two polygons, you can end up with a
situation where your new, intersected polygon (under the same set of
assumptions) has lines that suddenly go the other way around the world. It can
get really gnarly really fast. As the article suggests, most people just give
up and split the polygons into pieces.

~~~
zokier
> given a sequence of points representing a polygon, it will not always the
> case that the shorter line connecting two points is the intended one, for
> example

> intersected polygon (under the same set of assumptions) has lines that
> suddenly go the other way around the world

would be really cool to actually see these examples

I do not doubt that naive great circle shortest path might fall apart in
pathological cases, but I have difficulty understanding why that would be the
case. And the article does nothing to explain why this seemingly obvious
solution wouldn't work, your comment already was more enlightening.

~~~
NovemberWhiskey
Your simplest Euclidean polygon is the triangle. Imagine the triangle is
defined by the cities of London, Tokyo and New York.

Assuming the world is a sphere (which we know it isn't, but it's not
disastrously wrong for these purposes), that gives you something that looks
like this:

[http://gc.kls2.com/cgi-bin/gc?PATH=NYC-TYO-LON-NYC](http://gc.kls2.com/cgi-
bin/gc?PATH=NYC-TYO-LON-NYC)

The slightly-curved lines represent the shortest distance between those
points; the great circle routes.

Now take your typical world map (probably a Mercator projection) and draw the
same triangle on it using straight lines along the shortest distances on the
map.

Notice that the triangle on the world map includes within its area a
significant chunk of Central Asia and absolutely none of Greenland.

Imagine how unsuccessful you would be trying to intersect the world-map
triangle with another polygon; it would be completely meaningless.

~~~
zokier
obviously straight lines on (some) projections are very wonky on a sphere (or
geoid), as would be shapes built on those lines. That was not really the
question though, the question was that if you have shapes defined by points
connected with shortest _great circle_ paths then when (and how) would that
fail?

Sibling comment already raised the good point that great circles do not work
that well on spheroids and other more complex models of Earth, but I got the
impression that it was not what apendleton was referring to

------
mdswanson
I experienced a little shell shock reading this post. I ran into all of these
problems (and more) while building an interactive editor in VR. Selecting
things across the "180th meridian", grouping them, aligning them, distributing
them, etc.

------
uj8efdkjfdshf
Why not just internally represent longitude as being between 0 to 360 (mod
360)? This way you won't have a discontinuity in direction when going from one
longitude to another.

~~~
apendleton
You still have a discontinuity, you've just moved it from the antemeridian
(+/-180 degrees) to the prime meridian (0 degrees). The issue isn't the sign,
it's the wrapping.

In a lot of ways, this is actually worse. Lots of software can ignore problems
posed by antemeridian-crossing geometries because in practice, not that many
people encounter them (not many people live there). This would move any
problems to the middle of the UK, plus a good chunk of west Africa.

------
NovemberWhiskey
Honestly I'm with a few of the other posters here: I don't get it.

You obviously can't just project two lat/lon pairs into the plane and then
expect to be able to draw a straight line between in the projection coordinate
system (x/y) and have the result _mean_ anything, unless those points are
extremely close together.

On a Mercator projection that will happen to be a rhumb line, but that's a
specific property of that projection.

If you want to know the point halfway along the shortest distance between two
lat/lons (and you're prepared to accept the better-but-not-accurate spherical
earth model), you can use spherical geometry to determine the mid waypoint
along the great circle route.

The futility of thinking otherwise is expressed by the fact that the
projection that does map straight lines in the projection to great circles on
the globe - i.e. the gnomonic projection - can only show half the world on a
map of finite size.

------
projektfu
Would mapping to a different coordinate system help? Representing the values
as sine of spherical coordinates, for example, then converting back for
presentation?

~~~
cozzyd
asin(x) is multi-valued over the domain of longitude

~~~
projektfu
True. Maybe just converting to radians and then nobody will question your
eventual math for correctness.

------
cbdumas
I may be missing something here but the example given of finding the midpoint
between to points across the antimeridian seems at best misleading. The
formula given, averaging each coordinate, does not work for spherical
coordinates as this post demonstrates. And the correct formula for doing so is
never given.

~~~
madcaptenor
It works approximately over small distances, though (such as the New Zealand
example). Going down the spherical coordinates rabbit hole, so that for
example you could find the midpoint on a flight from Los Angeles to Tokyo,
would detract from the point of the post.

------
randyrand
You could also just always specify the left-most point first.

If it should cross the meridian it would be easy to detect.

------
johnmorrow
Nice watercolors

~~~
tmcw
Thank you!

------
Naga
Mostly off-topic, but relevant to another famous meridian is a song by my
favourite band:
[https://www.youtube.com/watch?v=BCFo0a8V-Ag](https://www.youtube.com/watch?v=BCFo0a8V-Ag)

