[postgis-users] Difference beetween ST_ClosestPoint and ST_Intersection

aperi2007 aperi2007 at gmail.com
Tue Jan 11 11:52:17 PST 2011


Hi,

I need to find the intersection point between two lines,
the first choice is ST_Intersection, but I notice even the 
ST_ClosestPoint function.

Testing both:

select ST_AsText(ST_ClosestPoint(ST_GeomFromEWKT('SRID=3003;LINESTRING(4 
4, 6 6)'),ST_GeomFromEWKT('SRID=3003;LINESTRING(12 1, 3 5)')));

--> POINT(4.38461538461539 4.38461538461539)

select ST_AsText(ST_Intersection(ST_GeomFromEWKT('SRID=3003;LINESTRING(4 
4, 6 6)'),ST_GeomFromEWKT('SRID=3003;LINESTRING(12 1, 3 5)')));

--> POINT(4.38461538461539 4.38461538461539)

They gave the same result.

Supposing the geometry to check are linestrings
there is some difference between the two functions ?

Thx,

Andrea.




More information about the postgis-users mailing list