Opened 15 years ago
Closed 15 years ago
#14318 closed (fixed)
Add GEOSGeometry.valid_reason
| Reported by: | Robert Coup | Owned by: | jbronn |
|---|---|---|---|
| Component: | GIS | Version: | dev |
| Severity: | Keywords: | geos | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
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)
Change History (5)
by , 15 years ago
| Attachment: | geos_validreason.1.diff added |
|---|
by , 15 years ago
| Attachment: | geos_validreason.2.diff added |
|---|
comment:1 by , 15 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → 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 by , 15 years ago
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 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Patch against r13683 (without the random test_sqlite change this time)