postgrespro / pgsphere

PgSphere provides spherical data types, functions, operators, and indexing for PostgreSQL.
https://pgsphere.org
BSD 3-Clause "New" or "Revised" License
16 stars 15 forks source link

Documentation improvement #31

Closed vitcpp closed 11 months ago

vitcpp commented 11 months ago

Dear All,

Issue. Wrong sline description I've found in sline description the following text: A spherical line is part of a great circle (meridian) that has a beginning and an end and hence, a direction. I guess it is a wrong statement. The line like sline( spoint '(0d, 10d)', spoint '(10d, 10d)' ) is not a part of a great circle (?) but it is a valid sline. Great circle is defined as the cut of the sphere by a plane containing the sphere center. What do you think?

esabol commented 11 months ago

Wikipedia says, "Through any two points on a sphere that are not antipodal points (directly opposite each other), there is a unique great circle." So the documentation seems correct to me, and I think there is a great circle that passes through the points spoint(0d, 10d) and spoint(10d, 10d).

Aside: Does sline() return an error if you specify two points on the direct opposite sides of the sphere? I would think it should since there are an infinite number of lines between such antipodal points.

vitcpp commented 11 months ago

It seems you are right. I checked sline length and dist. They are identical. pgsphere works with great circles (it is assumed we have an observer in the center of the sphere). All the angular distances should be relative to the sphere center. I clarified it for myself. Thank you.

The question on your answer about sline with opposite points: postgres=# select sline( spoint '(0, 0)', spoint '(180d, 0)' ); ERROR: sphereline_from_points: length of line must be not equal 180 degrees

vitcpp commented 11 months ago

I close this issue because the answer is obtained. It would be better to create new issues for particular problems in the doc. I was a little bit out of context when asking such a question. When we work with distances on the sphere we use geodesic lines on the sphere that reside on great circles. Sorry for disturbing.