Hello all

In all Apache SIS releases (including 1.2), the Mercator projection intentionally does not wraparound the longitude values into the -180°…+180° range. For example a longitude value of 181° is converted to metres as-is, without prior conversion to -179°. It was intentional, for keeping the function as continuous as possible (wraparounds are discontinuities in the mathematical function).

However this behavior of the Mercator projection was different than the behavior of almost all other projections. Most projections perform an implicit wraparound, because the longitude value is typically used in expressions like sin(longitude) or cos(longitude). In those cases, a wraparound is implicitly done by the trigonometric function.

On May 12, an "artificial" wraparound has been added to the Mercator projection for getting the same effect than other projections. This changes was not included in SIS 1.2 release, in order to give us more time to see the consequences. But now we are seeing cases where this workaround is causing problems. I posted a comment in the following JIRA issue with pictures trying to illustrate the problem:

   https://issues.apache.org/jira/browse/SIS-547

In a nutshell, wraparound is a problem which can often not be solved at the points level. It often needs to be solved at the geometry or raster level, in which case applying wraparound on the transformed points hide information that the geometry or the raster needs for solving the problem.

A counter-argument would be that wraparounds are implicit in almost all other projections (because of trigonometry), and if the application of wraparounds in Mercator breaks some code, then that code will be broken with other projections as well. But a counter-counter argument is that the Mercator projection is often used for world-wide views, which is not the case of most other projections.

So I wonder if we should revert this commit (which was adding wraparound in Mercator projection):

   https://github.com/apache/sis/commit/3fa01381f14ddac330c2b5e6cc86bd144afd90d8

The consequence would be that if users really want wraparound in Mercator projection, they would need to apply it themselves. This is admittedly not convenient. An alternative would be to add a parameter in the projection for specifying whether we want wraparound or not, but that would be SIS-specific and difficult to specify when building a CRS from EPSG code.

Any thoughts?

    Martin


Reply via email to