#2015 closed defect (fixed)
ST_IsEmpty('POLYGON(EMPTY)') returns False
Reported by: | cdestigter | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.1.0 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description
Firstly, I used the wkb for POLYGON(EMPTY), since postgis' wkt parser appears to cast a lot of things to GEOMETRYCOLLECTION EMPTY, losing type information.
But shouldn't this return True?
# select st_isempty('01030000000100000000000000'::geometry);
st_isempty
f
(1 row)
Also see this geos bug which exacerbates the problem: http://trac.osgeo.org/geos/ticket/594
POSTGIS="2.1.0SVN r10262" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.6"
Change History (9)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Milestone: | PostGIS 2.1.0 → PostGIS GEOS |
---|
I also checked this on 2.1+
SELECT ST_AsEWKT('POLYGON EMPTY'::geometry);
Comes back as POLYGON EMPTY. We stopped throwing out this info at 2.0. So you should be fine to use that. So your issue might be a pure GEOS and possibly GEOS with django.
comment:3 by , 12 years ago
This isn't a GEOS issue (or, maybe GEOS has a similar WKB interpretation issue), but anyway, I've decided to treat "polygon with a zero vertex ring" as "empty", in the same way "polygon with no rings" is empty. So the example query above will return true. As a side effect, you won't be able to round-trip WKB of the form 01030000000100000000000000. Instead if you put in 01030000000100000000000000 (polygon with one empty ring) you'll get out 010300000000000000 (polygon with no rings).
comment:4 by , 12 years ago
Milestone: | PostGIS GEOS → PostGIS 2.1.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Done at r10630
comment:6 by , 12 years ago
It's the old WKB handling code, so fairly un-fun. Not sure what other issues one might run into. What's the benefit?
comment:8 by , 12 years ago
It's a change in behaviour, but not an unreasonable one, I don't think. Scary WKB scares me
Are you sure you typed POLYGON(EMPTY). That isn't valid. In fact I get a parse error when I try to cast that to a geometry.
An empty polygon is this:
What your bytea resolves to is this:
Which I'm not quite sure what to call that.