[PROJ] about projinfo and --spatial-test

Javier Jimenez Shaw j1 at jimenezshaw.com
Fri Jan 20 11:11:01 PST 2023


Hi

Inspecting the code of projinfo, I see a situation that may show the
message
"Note: using '--spatial-test intersects' would bring more relevant results".
Looking at the code, it happens only when using "--spatial-test" option
with "intersects" or default ("contains") both return 1 operation... but
different.
How is that possible? I would expect that "intersects" contains all in
"contains".

The code involved is this

        list = CoordinateOperationFactory::create()->createOperations(
            nnSourceCRS, nnTargetCRS, ctxt);
        if (!spatialCriterionExplicitlySpecified &&
            spatialCriterion ==
CoordinateOperationContext::SpatialCriterion::
                                    STRICT_CONTAINMENT) {
            try {
                ctxt->setSpatialCriterion(
                    CoordinateOperationContext::SpatialCriterion::
                        PARTIAL_INTERSECTION);
                auto list2 =
                    CoordinateOperationFactory::create()->createOperations(
                        nnSourceCRS, nnTargetCRS, ctxt);
                spatialCriterionPartialIntersectionResultCount =
list2.size();
                if (spatialCriterionPartialIntersectionResultCount == 1 &&
                    list.size() == 1 &&
                    list2[0]->nameStr() != list[0]->nameStr()) {
                    spatialCriterionPartialIntersectionMoreRelevant = true;
                }
            } catch (const std::exception &) {
            }
        }
....
        if (spatialCriterionPartialIntersectionMoreRelevant) {
           std::cout << "Note: using '--spatial-test intersects' would
bring "
                        "more relevant results."
                     << std::endl;
       }

Thanks
Javier
.___ ._ ..._ .. . ._.  .___ .. __ . _. . __..  ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20230120/bdbb2baf/attachment.htm>


More information about the PROJ mailing list