Try harder to reproject envelopes with projections having a complex valid area
Description
Some projections have a valid area with a difficult representation in geographic coordinates, e.g., a circle, o multiple polygons, and typically just fail to reproject. Use a bisection inspired method to reproject them nevertheless, recursively narrowing on the valid area, with a recursion limit, and some stop condition based on the growth of the valid area.
While it’s not “precise”, envelope reprojection itself never is, as the reprojection of an envelope is typically a complex polygon, not another rectangle (and there are already a number of heuristics to include difficult positions past a semi-working initial projection, that is at least not throwing an exception).
Some projections have a valid area with a difficult representation in geographic coordinates, e.g., a circle, o multiple polygons, and typically just fail to reproject. Use a bisection inspired method to reproject them nevertheless, recursively narrowing on the valid area, with a recursion limit, and some stop condition based on the growth of the valid area.
While it’s not “precise”, envelope reprojection itself never is, as the reprojection of an envelope is typically a complex polygon, not another rectangle (and there are already a number of heuristics to include difficult positions past a semi-working initial projection, that is at least not throwing an exception).