Code

Opened 4 years ago

Closed 3 years ago

#14318 closed (fixed)

Add GEOSGeometry.valid_reason

Reported by: rcoup Owned by: jbronn
Component: GIS Version: master
Severity: Keywords: geos
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When you're messing with geometries it's handy to find out the reason why they're invalid. GEOS >= v3.1 supports GEOSisValidReason() for that purpose - returning a string about why a geometry is invalid. The attached patch adds support to the GeoDjango GEOS bindings as GEOSGeometry.valid_reason.

Tests, docs, and error-chucking for GEOS <v3.1 are included.

Attachments (2)

geos_validreason.1.diff (4.3 KB) - added by rcoup 4 years ago.
Patch against r13683 (without the random test_sqlite change this time)
geos_validreason.2.diff (4.6 KB) - added by jbronn 3 years ago.

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by rcoup

Patch against r13683 (without the random test_sqlite change this time)

Changed 3 years ago by jbronn

comment:1 Changed 3 years ago by jbronn

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to jbronn
  • Patch needs improvement unset
  • Status changed from new to assigned

Updated the patch to make sure 3.1 is available before making prototype for GEOSisValidReason (else there'd be an AttributeError when trying to get function from C library). 99% ready for check-in, only thing that's bugging me is whether we should rename property invalid_reason, because users are only checking when geometries are invalid.

comment:2 Changed 3 years ago by rcoup

only thing that's bugging me is whether we should rename property invalid_reason

Yeah, I was in two minds as well. You do get a "Valid Geometry" message. TBH i would have preferred None or "" but I didn't want to forcibly change the return value. +0

comment:3 Changed 3 years ago by jbronn

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [14447]) Fixed #14318 -- Added GEOSGeometry.valid_reason property. Thanks, Rob Coup.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.