Ticket #567 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Shapely cannot compare a geometry with None

Reported by: elemoine Owned by: elemoine
Priority: blocker Milestone: framework.server 1.2.2 Release
Component: framework.server Version: SVN
Keywords: Cc:
State: Commit

Description

In our Geometry TypeEngine we have this compare_values method for comparing geometries:

    def compare_values(self, x, y):
        return x.equals(y)

(x and y are Shapely geometries)

But Shapely gives an error when comparing a geometry with None (geometry.equals(None)). So I suggest that we guard against that and change our code to:

    def compare_values(self, x, y):
        t = (x, y)
        if None not in t:
            return x.equals(y)
        return t == (None, None)

Attachments

patch-567-A0.diff (511 bytes) - added by elemoine 3 years ago.

Change History

Changed 3 years ago by elemoine

Changed 3 years ago by elemoine

  • state set to Review
  • milestone set to framework.server 1.2.2 Release

Tests continue to pass. Please review.

Changed 3 years ago by aabt

  • state changed from Review to Commit

Looks good to me, thanks for the patch. Please commit.

Changed 3 years ago by elemoine

  • status changed from new to closed
  • resolution set to fixed

(In [3453]) Shapely cannot compare a geometry to None, work around that, r=aabt (closes #567)

Note: See TracTickets for help on using tickets.