I have a strange st_difference
behaviour. I’ve got two overlapping lines (each one has two points), but st_difference
result is complete geometry of the first line.
The code to reproduce is here:
WITH
mylines AS
(
SELECT
st_geomfromtext('LINESTRING(4377625.44 7399187.54,4377633.47 7398278.09)') as ro_geom,
st_geomfromtext('LINESTRING(4377625.44 7399187.54,4377630.67957507 7398594.12386704)') as lk_geom
)
select
1 as gid,
st_difference(ro_geom, lk_geom) as diff_geom
from mylines
So the st_difference
between red and blue lines returns a green line, which isn't expected. I'd expect the green line to be shorter and below the blue one (without overlapping it).
This is just a test example I've made for demonstration of the problem. In practice, I'm using st_difference
for two huge datasets and every difference looks unexpected.
Any clues?