[PROJ] intersects function

Javier Jimenez Shaw j1 at jimenezshaw.com
Sat Jun 8 15:30:48 PDT 2024


Thanks Even. It make sense.
And that explains why I cannot use a bbox in projinfo with w==e and s==n to
represent a single point. Unfortunately.
IMHO the boundaries of the bounding box are included in the region, so a
boundary with w==e and s==n would be valid one... that is a single point.
That could intersect with another (non degenerated) bounding box normally.
I am using that understanding in a branch of the crs-explorer so allow a
point or a rectangle intersect with a CRS without complicating the code a
lot.
But I don't want to open a discussion about that now in PROJ.
Now I understand the algorithm and can implement it in js. Thank you.

Cheers,
Javier.

On Sat, 8 Jun 2024 at 23:48, Even Rouault <even.rouault at spatialys.com>
wrote:

> Javier,
>
> But the second and third I would expect
>     if (W == -180.0 && E == 180.0) {
>         return true;
>     }
>
>     if (oW == -180.0 && oE == 180.0) {
>         return true;
>     }
> if it covers the whole planet (from -180 to 180) it clearly intersects,
> right? Or am I missing something? (after is passes the first if statement
> on N-S)
>
> This is mostly for symmetry with the intersection() method that needs to
> deal specifically with that case where the other bounding box crosses the
> antimeridian. For normal cases, for intersects(), we could remove that
> extra check as you suggested, but when trying to do so, this causes the
> test added in
> https://github.com/OSGeo/PROJ/commit/c3c9068b54cc190ce81c1fd7ea8b62aaa4c2af97#diff-076233f62785619274b55e6b0d7e45a7d5a25c019b07046f77c2ad0504f7f92dR289
> to fail. This is a edge / non-nominal case that was added when dealing with
> an issue discovered by ossfuzz. Not sure what the expected result
> false/true should be for a degenerate bbox with W=E=180. Not that I think
> it really matters (and I'm not willing to initiate yet another discussion
> about emptyness, which would be better brought to geos-dev :-) ). The only
> thing that matters here is to make sure this doesn't go into infinite
> recursion in those edge cases.
>
> Comments added in https://github.com/OSGeo/PROJ/pull/4169
>
> -- http://www.spatialys.com
> My software is free, but my time generally not.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20240609/1c765e36/attachment.htm>


More information about the PROJ mailing list