I drew a rectangular region on a Mercator map and used FootprintOverlapDetector to detect the start and end of contact. I found that the detection result is exactly opposite to the bending direction of the Mercator projection. I’m not sure if this is a bug, or if there is any configuration option to adjust this direction.

The following images illustrate the comparison between the Mercator rectangle and the curvature of the sphere, and the last one shows the result of multiple rectangular fields of view generated by FootprintOverlapDetector:

When defining a region on the sphere (close to Earth ellipsoid) by some boundary vertices, the edge between the vertices is a portion of a sphere great circle, which is the closest path from one point to the other. The portion of the great circle that is selected is the one that corresponds to an arc length less than 180°. So if both points are on the equator, this would be a straight line in most geographic projections. If the points are at the same southern latitude, the arc would bend such that the intermediate points have more southern latitudes than the vertices. In this case, the middle point would have the most southern latitude of the arc. If we completed this arc to a full circle, there would be points of this circle, on the other side of the Earth, that would have northern latitudes. Of course symmetrical behavior can be observed if both points are at the same northern latitude.

So the shape you observe in the last picture seems correct to me. A long edge at constant latitude cannot be represented just by its two extreme points as it is not an arc of a great circle on the sphere, it is an arc of a small circle. If you want to represent a constant latitude edge, you have to sample the edge, putting several intermediate points (which is easy since they all have the same latitude). It will be an approximation, close to what you want to model if you select many points, far from what you want to model if you select just a few points. Note that you don’t need to over-sample edges at constant latitude, because they already are sphere great circles.

We cannot represent small circles due to the underlying theory that we use for representing regions, which is Binary Space Partitioning Trees. This theory requires modeling hyper-planes at tree nodes and hyper-planes on the 2D sphere are great circles.

Okay, I understand what you mean. However, the effect seen on a Mercator projection when transformed to a globe is that if two points are at the same latitude south, the arc will curve such that the points in the middle have a higher latitude south than the vertex points. This is the opposite of what you are describing (and what is seen in the second image). I would like to hear your analysis of why this occurs. You can also visit this website: https://geojson.io/ and draw a rectangular area (same latitude) and then switch between Globe and Mercator to see the effect.

Based on my test results, I suspect that the underlying logic might have reversed the North and South poles. If they were reversed, I think the results would be correct.

Yes and it is not what we do, hence we don’t draw the same shape. You should not start from 2D-Mercator and then switch back to 3D. The edge is really defined in 3D first and then projected when you draw your picture. In fact, inside the computation, we do not switch back to 2D, we define the shape on the spherical topology (where hyper-planes are great circles), and we remain in spherical topology.

The red arc is a great circle, it is a portion of a plane (hence it is straight in some sense) in 3D, a plane that contains the center of the Earth and intersects the sphere. Since you draw just a portion of this great circle (the red part) and since you know this plane also contains Earth center, then this means this plane is inclined with respect to equator. What you see here is the portion that is below equator, there is a symmetrical portion above the equator on the other side, which you do not see. The red arc is the basic building block we use.

The white arc is something completely different. It starts as a straight line in 2D on the Mercator projection, and then it is plunged in 3D. As in 2D it is a straight line with constant latitude, it is the intersection of a plane that is parallel to the equator but does not contains Earth center. It is not a great circle on the sphere and it is not what we use to build the shape.

So yes, red and white arcs are opposite, and it is expected. Red arc is what we use, white arc is what Mercator represents as iso-latitude lines.

Okay, I understand what you’re saying now. However, when we select regions, the Mercator projection is still the most commonly used. Based on what you said, using rectangles to select larger areas might not be recommended. But rectangular selection is also simpler. Do you have any recommendations on how I can convert from a rectangular selection in the Mercator projection to a multipolygon area that conforms to SphericalPolygonsSet?

Yes you can, here is what I would suggest.
Given two points at the same latitude \varphi and separated by some longitude difference \Delta\lambda_{\varepsilon}, we create the great circle the goes through these two points. If for example \varphi <0 then this great circle starts at one point at latitude \varphi, heads towards South, reaches a minimum latitude \varphi' = \varphi -\varepsilon in the middle of the edge between the two extreme points and then heads back North until it reaches again latitude \varphi when reaching the second point. There is a relationship between the longitude difference and the latitude error \varepsilon, this is the reason why I used a subscript \varepsilon when writing \Delta\lambda_{\varepsilon}. What we want is compute this relationship, and in fact check how large we can select \Delta\lambda_{\varepsilon} while still fulfilling some predefined tolerance \varepsilon when using a great circle instead of an iso-latitude line.

Solving the spherical triangle defined by the great circle, the equator and the meridian containing one of the extreme points, we can compute the \tan(\varphi')=\frac{\tan\varphi}{\cos\left(\frac{\Delta\lambda_{\varepsilon}}{2}\right)}. Inserting the error \varepsilon back into this equation and inverting it (taking the absolute value of \varphi to take care of southern latitudes), we get \Delta\lambda_{\varepsilon}=2\arccos\left(\frac{\tan|\varphi|}{\tan(|\varphi|+\varepsilon)}\right). This expression gives us the maximum longitude offset \Delta\lambda_{\varepsilon} we can accept if we accept a latitude error \varepsilon. This implies that if you have two points that define an iso-latitude \varphi and want to define a region with some tolerance \varepsilon, you can compute the number of points you need to insert so the latitude error between each pair of intermediate points fulfills your tolerance settings.

If I take for example your northern limit. It is at \varphi=-29^{\circ} and the two extreme points are 60^{\circ} apart. Let’s say we accept a latitude error of 0.01^{\circ}, we get \Delta\lambda_{\varepsilon}=3.287^{\circ}, so we need to split our 60^{\circ} edge into 19 intervals. So we replace the two extreme points at latitude \varphi=-29^{\circ} by a list of 20 points at latitude \varphi=-29^{\circ} and we fulfill our error constraint. If we accept only 0.001^{\circ} as the maximum latitude error, than we need to split our iso-latitude edge into 58 intervals. Be aware that the number of points depends on the latitude, so splitting the northern edge at -29^{\circ} does not lead to the same number of intervals than splitting the southern edge at -45^{\circ}. We do not need to split the North-South meridian edges.