[postgis-devel] isvalid(geom), but st_ashexewkb(geom, 'NDR')::geometry fails

Obe, Regina robe.dnd at cityofboston.gov
Fri Oct 24 08:40:43 PDT 2008


David,

Well it is all kind of bizarre.  Which build exactly are you using.  Are
you using an old 1.3.4 trunk version?

If I do any of the following

SELECT
ST_AsText('0106000020C90E00000100000001030000000100000000000000');
SELECT '0106000020C90E00000100000001030000000100000000000000'::geometry;
SELECT
ST_IsValid('0106000020C90E00000100000001030000000100000000000000');

I get the below error on my 1.3.3 or 1.3.4SVN (I have to check my
vintage)
ERROR:  geometry requires more points

ST_IsValid doesn't return anything for me because apparently its so
bogus that it errors out before it can even attempt to run validity
checks.

What does your SELECT postgis_full_version(); return

There is not enough info given by postgis_version(); for me to tell what
you are running.

Thanks,
Regina

 

-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net
[mailto:postgis-devel-bounces at postgis.refractions.net] On Behalf Of
David Fuhry
Sent: Friday, October 24, 2008 11:25 AM
To: PostGIS Development Discussion
Subject: Re: [postgis-devel] isvalid(geom), but
st_ashexewkb(geom,'NDR')::geometry fails

Regina,

    Yeah, I agree that the WKT is not valid.  The real question is, is 
the WKB valid?  If not, isvalid() should return false.  If so, the 
parser should parse it without error.

    ST_GeomFromText('MULTIPOLYGON EMPTY') returns a different geometry 
from mine.  Adding the srid makes it a little closer, but not the same. 
  Both of these are correctly identified as st_isempty(), although mine 
is not.

db=> select st_geomfromtext('MULTIPOLYGON EMPTY');
   st_geomfromtext
--------------------
  010700000000000000
(1 row)

db=> select setsrid(st_geomfromtext('MULTIPOLYGON EMPTY'), 3785);
           setsrid
----------------------------
  0107000020C90E000000000000
(1 row)


Thanks,

Dave


Obe, Regina wrote:
> David,
> 
> I don't think that is valid WKT syntax for an EMPTY multipolygon. If I

> try to stuff that in via ST_GeomFromText it returns invalid geometry. 
> Not sure how you got that in there.
> 
> It should be
> 
>  SELECT ST_GeomFromText('MULTIPOLYGON EMPTY');
> 
> 
> On 1.3.3 and 1.3.4SVN - when I do this - I get the below which is also

> kind of odd.  I would have expected it to maintain the empty polygon.
> 
>  SELECT ST_IsValid(the_geom), ST_AsText(the_geom),
ST_IsEmpty(the_geom), 
> ST_AsEWKT(the_geom)  FROM (SELECT ST_GeomFromText('MULTIPOLYGON
EMPTY') 
> As the_geom) As foo ;
>  st_isvalid |        st_astext         | st_isempty |        
> st_asewkt        
>
------------+--------------------------+------------+-------------------
-------
>  t          | GEOMETRYCOLLECTION EMPTY | t          |
GEOMETRYCOLLECTION 
> EMPTY
> (1 row)
> 
> Hope that helps,
> Regina
> -----Original Message-----
> From: postgis-devel-bounces at postgis.refractions.net on behalf of David
Fuhry
> Sent: Thu 10/23/2008 11:28 PM
> To: PostGIS Development Discussion
> Subject: [postgis-devel] isvalid(geom), but 
> st_ashexewkb(geom,'NDR')::geometry fails
> 
> I have an empty multipolygon which isvalid(), but which the parser
> throws "ERROR:  geometry requires more points" on.  Is this a bug in
> isvalid(), or in the parser?  Interestingly, st_isempty() returns
false.
> 
> db=> select geom from tt;
>                           geom
> ------------------------------------------------------
>   0106000020C90E00000100000001030000000100000000000000
> (1 row)
> 
> db=> select st_astext(geom) from tt;
>         st_astext
> ------------------------
>   MULTIPOLYGON(( EMPTY))
> (1 row)
> 
> db=> select isvalid(geom) from tt;
>   isvalid
> ---------
>   t
> (1 row)
> 
> db=> select st_ashexewkb(geom,'NDR')::geometry from tt;
> ERROR:  geometry requires more points
> 
> db=> select st_isempty(geom) from tt;
>   st_isempty
> ------------
>   f
> (1 row)
> 
> db=> select version(), postgis_version();
>                                          version
>                   |            postgis_version
>
-----------------------------------------------------------------------
> -----------------+---------------------------------------
>   PostgreSQL 8.3.1 on i486-pc-linux-gnu, compiled by GCC cc (GCC)
4.2.3
> (Debian 4.2.3-4) | 1.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
> (1 row)
> 
> Thanks,
> 
> Dave
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
> 
> 
>
------------------------------------------------------------------------
> 
> * The substance of this message, including any attachments, may be 
> confidential, legally privileged and/or exempt from disclosure
pursuant 
> to Massachusetts law. It is intended solely for the addressee. If you 
> received this in error, please contact the sender and delete the 
> material from any computer. *
> 
>
------------------------------------------------------------------------
> 
> * Help make the earth a greener place. If at all possible resist 
> printing this email and join us in saving paper. *
> 
> * *
> 
> * *
> 
> 
>
------------------------------------------------------------------------
> 
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel



More information about the postgis-devel mailing list