[postgis-users] intersection problem

Daniele Debernardi daniele at geosar.ch
Wed Jul 4 00:04:53 PDT 2012


I wrote a semplified example:

with this line:

geomfromtext('LINESTRING(15 56,80 12)')

and this substring line:

st_line_substring(geomfromtext('LINESTRING(15 56,80 12)'),0,0.6)
=> LINESTRING(15 56,54 29.6)

if i make the intersection i get only the first point:

st_intersection(
     geomfromtext('LINESTRING(15 56,80 12)'),
     st_line_substring(geomfromtext('LINESTRING(15 56,80 12)'),0,0.6)
)

=> POINT(15 56)

my expected result should be:

=> LINESTRING(15 56,54 29.6)

because if I take a substring of a line, the intersection with the 
original line is the
substring line, correct?

thx for any help on this strange thing
Daniele



On 03. 07. 12 13:35, Daniele Debernardi wrote:
> hi,
> I have a problem with an intersection with 2 lines that don't return 
> what I expect:
>
> sample intersection between a line and a substring of the same line:
> first line: LINESTRING(675315.7 158956.9,675280 158912.9)
> second: st_makeline(geomfromtext('POINT(675315.7 158956.9)'),
> ST_Line_Interpolate_Point(geomfromtext('LINESTRING(675315.7 
> 158956.9,675280 158912.9)'),0.6))
>
> select st_astext(st_intersection(
>     geomfromtext('LINESTRING(675315.7 158956.9,675280 158912.9)'),
>     st_makeline(geomfromtext('POINT(675315.7 158956.9)'),
> ST_Line_Interpolate_Point(geomfromtext('LINESTRING(675315.7 
> 158956.9,675280 158912.9)'),0.6))
> ));
>
> result: POINT(675315.7 158956.9)
>
> what I expect is that the result of the intersection is not only the 
> point of start of the 2 lines, but a linestring
> starting with that point but ending with the point returned by the 
> interpolation (expected to be over the line)
>
> I'm doing something wrong with the intersection? there is another way 
> to get the result I expect?
> or is a problem in postgis?
>
> ps: I'm using the POSTGIS 1.5.3 version
>
> thx for help
> Daniele
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


-- 
Cordiali saluti,
ing. Daniele Debernardi

--------------------------------------------
GEOSAR SA
Casella Postale 729
CH-6512 Giubiasco
T: +41 (0)91 220 49 94
www.geosar.ch




More information about the postgis-users mailing list