Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does SQL Server GEOGRAPHY allow longitudes between -15069° and +15069°? Why ±15069°?

I am using the Microsoft.SqlServer.Types DLL in my projects for validating Latitudes and Longitudes.

The Library validates longitude values between -15069 and 15069 degrees instead from -180 to 180. Can anybody explain what is the significance or reason that Microsoft is checking the longitude values to be between -15069 and 15069 degrees?

Microsoft has listed the standards for Geo Spatial standards on this website which mentions the Longitude values MUST be between -15069 and 15069 degrees, inclusive.

https://msdn.microsoft.com/en-us/library/ee301753(v=sql.105).aspx

Your inputs in understanding this concept will be appreciated!

like image 888
Rohit Surve Avatar asked Jun 11 '16 00:06

Rohit Surve


1 Answers

Why is longitude not restricted to [-180°..+180°]?

Here's a brief thought experiment. Which of the following three lines does LINESTRING (-180 0, 180 0) represent?

  1. A line going around the whole globe along the equator in an eastward direction.

  2. A line going around the whole globe along the equator in a westward direction.

  3. A line of length 0, since -180° latitude denotes the same meridian as +180° latitude.

As soon as you decide on any of the three possibilities, you will find that you have no way of modelling the other two cases as LINESTRING (try it!)… at least not when you restrict longitude to the (geographically correct) interval [-180°..+180°]!

Let's see what happens when we relax that restriction:

  • The line going around the globe in an eastward direction can now be modelled as LINESTRING (-180 0, 180 0). (This seems to match our expectations, since increasing degrees of longitude means "going eastward".)

  • The line going around the globe in a westward direction now becomes LINESTRING (-180 0, -540 0). (Decreasing degrees of longitude denotes "going westward".)

  • The line of length 0 becomes LINESTRING (-180 0, -180 0). (No change in coordinates means "no distance travelled".)

Yes, but why did they chose exactly ±15069 degrees?

That, I cannot say. It might have to do with floating-point precision (i.e. spatial computations becoming too imprecise if you specified a point that's "wrapped around" the globe more than 15,069° ÷ 360° = 41,8583… times) or simply a arbitrary limit (i.e. they thought noone will need to be able to construct a spiral that goes around the globe more than approx. 42 times).

Why was latitude restricted to [-90°..+90°], if longitude wasn't restricted?

Let's repeat the above thought experiment: What does LINESTRING (0 90, 0 -90) mean?

  1. A line going around half the globe along the prime meridian in a southward direction.

  2. A line going around half the globe along the prime meridian in a northward direction.

  3. A line of length 0.

We can rule out (3), since POINT (0 90) and POINT (0 -90) are distinct points: namely, the north pole and the south pole. A line going from one to the other definitely does not have zero length.

We can also rule out (2), simply because it does not make any sense to say "going northward" when starting at the north pole. You can only stay there, or go south, which is already covered by (1).

So we end up unambiguously with (1). The reason, therefore, why latitude was restricted to the geographically meaningful [-90°..+90°] is because there is never any ambiguity when modelling lines that touch or cross the geographic poles. This is because there are no sudden degree "jumps" like there are with longitude (where one and the same meridian is described both by -180° and +180°).

like image 156
stakx - no longer contributing Avatar answered Oct 27 '22 00:10

stakx - no longer contributing