[postgis-users] ST_GeomFromText vs ST_MakeEnvelope

John Cartwright john.c.cartwright at comcast.net
Tue Oct 1 17:26:47 PDT 2013


Arrgh - tripped up by a simple typo. Thanks for pointing it out Mike.

--john

On Oct 1, 2013, at 4:02 PM, Mike Toews <mwtoews at gmail.com> wrote:

> On 2 October 2013 10:43, John Cartwright <john.c.cartwright at comcast.net> wrote:
>> select name, ST_AsText(a.geom) as geom from cities a where a.geom &&
>> ST_GeomFromText('POLYGON((-107 39, -102 39, -102 42, -17 42, -107 39))',
>> 4326);
> 
> This geometry is not the geometry that you think it is...
> 
> postgis=# SELECT v.valid, v.reason, ST_AsText(v.location)
> postgis-# FROM ST_IsValidDetail(
> postgis(#   ST_GeomFromText('POLYGON((-107 39, -102 39, -102 42, -17
> 42, -107 39))', 4326)) AS v;
> valid |      reason       |          st_astext
> -------+-------------------+------------------------------
> f     | Self-intersection | POINT(-102 39.1666666666667)
> (1 row)
> 
> 
> Try 'POLYGON((-107 39,-107 42,-102 42,-102 39,-107 39))' instead.
> 
> -Mike
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



More information about the postgis-users mailing list