On 29 September 2011 11:37, Sandro Santilli <s...@keybit.net> wrote: > On Thu, Sep 29, 2011 at 11:29:51AM +0200, Szymon Guz wrote: > > On 29 September 2011 11:20, Sandro Santilli <s...@keybit.net> wrote: > > > On Thu, Sep 29, 2011 at 11:14:52AM +0200, Szymon Guz wrote: > > > > > > > > this works OK, returns something: > > > > > > > > SELECT ... FROM ... WHERE > > > > st_intersects( > > > > geometry, > > > > st_geomfromtext('POINT(3 50)', 4326) > > > > ); > > > > > > > > but this returns nothing: > > > > > > > > SELECT ... FROM ... WHERE > > > > st_intersects( > > > > geometry, > > > > st_geomfromtext('POINT(3 50, 3 50 )', 4326) > > > > ); > > > > > > The second should raise an exception due to malformed WKT being used. > > > Doesn't it ? > > > > The second raises exception only if there is exactly one point. When > there > > are more points it works OK: > > > > SELECT st_geomfromtext('LINESTRING(3 50)', 4326) > > ERROR: geometry requires more points > > HINT: "LINESTRING(3 50)" <-- parse error at position 17 within geometry > > > > SELECT st_astext(st_geomfromtext('LINESTRING(3 50, 3 50)', 4326)) > > > > 'LINESTRING(3 50,3 50)' > > Yes, but you wrote 'POINT(3 50, 3 50)' in your first mail :) > > Anyway, you're now saying that while POINT(3 50) is reported > to intersect something, LINESTRING(3 50, 3 50) isn't. Correct ? > Can you provide literal data showing this discrepance ? > That is, a query where both operands are in WKT form ? > > --strk; >
Oh yes, sorry, I meant 'LINESTRING( 3 50, 3 50)' :) I managed to replicate the error like this: CREATE TABLE g2(geometry geometry); insert into g2(geometry) SELECT ST_Buffer( ST_GeomFromText('POINT(3 50)', 4326), 50, 'quad_segs=8' ); SELECT st_astext( st_intersection( geometry, st_geomfromtext('POINT(3 50)', 4326) ) ) "POINT(3 50)", st_astext( st_intersection( geometry, st_geomfromtext('LINESTRING(3 50, 3 50)', 4326) ) ) "LINESTRING(3 50, 3 50)", ( SELECT 'POINT' FROM g2 WHERE st_intersects( geometry, st_geomfromtext('POINT(3 50)', 4326) ) ) "POINT EXISTS", ( SELECT 'LINE' FROM g2 WHERE st_intersects( geometry, st_geomfromtext('LINESTRING(3 50, 3 50)', 4326) ) ) "LINESTRING EXISTS" FROM g2; BUT... it turned out that the LINESTRING geometry is not valid: SELECT ST_IsValid(st_geomfromtext('POINT(3 50)', 4326)) "POINT", ST_IsValid(st_geomfromtext('LINESTRING(3 50, 3 50)', 4326)) "LINE" ; I didn't just know that PostGIS is calm when the geometry is not valid and treats that as empty geometry. I thought it would just throw some error in such a case. -- *http://simononsoftware.com/* <http://simononsoftware.com/>
_______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users