ST_AsText rounds data so what you get back is not to the precision actually stored in your database. Try using ST_DWithin instead and adding in a small amount of buffer e.g. ST_DWithin(geom, your_point,0.00001) playing around with the distance. We never rely on intersects for point - line checks because if you have floating point junk it really screws up your calculations. Leo and Regina http://www.postgis.us
_____ From: [email protected] [mailto:[email protected]] On Behalf Of Richard Cernava Sent: Friday, May 17, 2013 7:40 PM To: [email protected] Subject: [postgis-users] Strange behavior I'm trying to query if a point is present inside a MultiLineString. When I run the following query I get very strange results in my opinion. If someone could elaborate as to what's going on it would be very much appreciated! >From this query I get a false and a true on the identical data. First I check to see if the_geom intersects with my point and receive false. Second I take the_geom and convert it to text and then compare it with my point using ST_GeomFromText and get true. How is this possible? I've outputted the result from the statement below. SELECT fullname, ST_X(ST_StartPoint(ST_LineMerge(the_geom))), ST_Y(ST_StartPoint(ST_LineMerge(the_geom))), ST_AsText(the_geom) AS text, ST_Intersects(the_geom, ST_GeomFromText('POINT(-122.837109 45.537746)', 4269)) AS fromdb, ST_Intersects(ST_GeomFromText(ST_AsText(the_geom), 4269), ST_GeomFromText('POINT(-122.837109 45.537746)', 4269)) AS fromtxt from tiger_data.or_edges where fullname like 'NW Norwich St' limit 1 "NW Norwich St";-122.837109;45.537746;"MULTILINESTRING((-122.837109 45.537746,-122.837253 45.537684,-122.837718 45.537368,-122.837829 45.537288,-122.838081 45.537108,-122.838169 45.537049))";f;t -- -Richard
_______________________________________________ postgis-users mailing list [email protected] http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
