Re: [postgis-users] Postgis overlapping two linestrings

2013-11-22 Thread James David Smith
Hi Ani,

Have you looked into st_intersects() ? and st_intersection() ?

http://postgis.refractions.net/docs/ST_Intersects.html

James

On 22 November 2013 16:17, Ani Alamo  wrote:
> Hi!
> I need a specific function to get if two linestring overlaps. e.g.
> Linestring 1 is Point (0, 0) : Point (10, 0) Linestring 2 is Point (0, 0) :
> Point (3, 0)
>
> In this case I need "true" result because LineString 1 overlaps in different
> points like 0,0 1,0 2,0 & 3,0. I dont need the common points, I only need if
> two linestring overlaps or not. I tried with this function in postgis...
>
> overlaps(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001))
> I create a buffer on both linestrings... but muy problem is some times works
> better, some times not.
>
> Can you help me please?
>
> Thanks!
>
> ___
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


Re: [postgis-users] Postgis overlapping two linestrings

2013-11-22 Thread Ani Alamo
Uhm... exactly I have this linestrings:
LINESTRING(2.118932325 41.398745991,2.168720219 41.385631938)
LINESTRING(2.142346041 41.398526436,2.81541 41.409216161)

intersections gives me:
GeometryCollection: GEOMETRYCOLLECTION EMPTY

intersects gives me:
false

but when I see the line drawn on map I see both lines intersect in a little
"section" (strectch). But really when I use intersects or intersection
functions gives me "unavailable intersection"... and when I use OVERLAPS
function
overlaps(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001)) also gives
me "false".

Another ideas please??


2013/11/22 James David Smith 

> Hi Ani,
>
> Have you looked into st_intersects() ? and st_intersection() ?
>
> http://postgis.refractions.net/docs/ST_Intersects.html
>
> James
>
> On 22 November 2013 16:17, Ani Alamo  wrote:
> > Hi!
> > I need a specific function to get if two linestring overlaps. e.g.
> > Linestring 1 is Point (0, 0) : Point (10, 0) Linestring 2 is Point (0,
> 0) :
> > Point (3, 0)
> >
> > In this case I need "true" result because LineString 1 overlaps in
> different
> > points like 0,0 1,0 2,0 & 3,0. I dont need the common points, I only
> need if
> > two linestring overlaps or not. I tried with this function in postgis...
> >
> > overlaps(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001))
> > I create a buffer on both linestrings... but muy problem is some times
> works
> > better, some times not.
> >
> > Can you help me please?
> >
> > Thanks!
> >
> > ___
> > postgis-users mailing list
> > postgis-users@lists.osgeo.org
> > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> ___
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Re: [postgis-users] Postgis overlapping two linestrings

2013-11-22 Thread Ani Alamo
I tried this function:
intersects(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001))
Always gives me "false" result.

I don't know what to do!


2013/11/22 Ani Alamo 

> Uhm... exactly I have this linestrings:
> LINESTRING(2.118932325 41.398745991,2.168720219 41.385631938)
> LINESTRING(2.142346041 41.398526436,2.81541 41.409216161)
>
> intersections gives me:
> GeometryCollection: GEOMETRYCOLLECTION EMPTY
>
> intersects gives me:
> false
>
> but when I see the line drawn on map I see both lines intersect in a
> little "section" (strectch). But really when I use intersects or
> intersection functions gives me "unavailable intersection"... and when I
> use OVERLAPS function
> overlaps(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001)) also
> gives me "false".
>
> Another ideas please??
>
>
> 2013/11/22 James David Smith 
>
>> Hi Ani,
>>
>> Have you looked into st_intersects() ? and st_intersection() ?
>>
>> http://postgis.refractions.net/docs/ST_Intersects.html
>>
>> James
>>
>> On 22 November 2013 16:17, Ani Alamo  wrote:
>> > Hi!
>> > I need a specific function to get if two linestring overlaps. e.g.
>> > Linestring 1 is Point (0, 0) : Point (10, 0) Linestring 2 is Point (0,
>> 0) :
>> > Point (3, 0)
>> >
>> > In this case I need "true" result because LineString 1 overlaps in
>> different
>> > points like 0,0 1,0 2,0 & 3,0. I dont need the common points, I only
>> need if
>> > two linestring overlaps or not. I tried with this function in postgis...
>> >
>> > overlaps(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001))
>> > I create a buffer on both linestrings... but muy problem is some times
>> works
>> > better, some times not.
>> >
>> > Can you help me please?
>> >
>> > Thanks!
>> >
>> > ___
>> > postgis-users mailing list
>> > postgis-users@lists.osgeo.org
>> > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>> ___
>> postgis-users mailing list
>> postgis-users@lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>
>
>
___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Re: [postgis-users] Postgis overlapping two linestrings

2013-11-22 Thread Rémi Cura
You may try
http://postgis.net/docs/ST_SharedPaths.html

Cheers,

Rémi-C


2013/11/22 Ani Alamo 

> I tried this function:
> intersects(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001))
> Always gives me "false" result.
>
> I don't know what to do!
>
>
> 2013/11/22 Ani Alamo 
>
>> Uhm... exactly I have this linestrings:
>> LINESTRING(2.118932325 41.398745991,2.168720219 41.385631938)
>> LINESTRING(2.142346041 41.398526436,2.81541 41.409216161)
>>
>>  intersections gives me:
>> GeometryCollection: GEOMETRYCOLLECTION EMPTY
>>
>> intersects gives me:
>> false
>>
>> but when I see the line drawn on map I see both lines intersect in a
>> little "section" (strectch). But really when I use intersects or
>> intersection functions gives me "unavailable intersection"... and when I
>> use OVERLAPS function
>> overlaps(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001)) also
>> gives me "false".
>>
>> Another ideas please??
>>
>>
>> 2013/11/22 James David Smith 
>>
>>> Hi Ani,
>>>
>>> Have you looked into st_intersects() ? and st_intersection() ?
>>>
>>> http://postgis.refractions.net/docs/ST_Intersects.html
>>>
>>> James
>>>
>>> On 22 November 2013 16:17, Ani Alamo  wrote:
>>> > Hi!
>>> > I need a specific function to get if two linestring overlaps. e.g.
>>> > Linestring 1 is Point (0, 0) : Point (10, 0) Linestring 2 is Point (0,
>>> 0) :
>>> > Point (3, 0)
>>> >
>>> > In this case I need "true" result because LineString 1 overlaps in
>>> different
>>> > points like 0,0 1,0 2,0 & 3,0. I dont need the common points, I only
>>> need if
>>> > two linestring overlaps or not. I tried with this function in
>>> postgis...
>>> >
>>> > overlaps(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001))
>>> > I create a buffer on both linestrings... but muy problem is some times
>>> works
>>> > better, some times not.
>>> >
>>> > Can you help me please?
>>> >
>>> > Thanks!
>>> >
>>> > ___
>>> > postgis-users mailing list
>>> > postgis-users@lists.osgeo.org
>>> > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>> ___
>>> postgis-users mailing list
>>> postgis-users@lists.osgeo.org
>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>>
>>
>>
>
> ___
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Re: [postgis-users] Postgis overlapping two linestrings

2013-11-22 Thread Rémi Cura
I hope you are not runnning into a very annoying precision issue.
If it were the case, you may want to try the patch I just submitted to
GEOS, (https://github.com/Remi-C/libgeos).

and then you would check  like this :
decompose line A into points (ST_DumPPoints)
if any point is on line B : true
else
decompose line B into points
if any point of B in on line A
return true
else return false

(you chekc "point on line" with st_intersects)

Cheers,

Rémi-C


2013/11/22 Rémi Cura 

> You may try
> http://postgis.net/docs/ST_SharedPaths.html
>
> Cheers,
>
> Rémi-C
>
>
> 2013/11/22 Ani Alamo 
>
>> I tried this function:
>> intersects(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001))
>> Always gives me "false" result.
>>
>> I don't know what to do!
>>
>>
>> 2013/11/22 Ani Alamo 
>>
>>> Uhm... exactly I have this linestrings:
>>> LINESTRING(2.118932325 41.398745991,2.168720219 41.385631938)
>>> LINESTRING(2.142346041 41.398526436,2.81541 41.409216161)
>>>
>>>  intersections gives me:
>>> GeometryCollection: GEOMETRYCOLLECTION EMPTY
>>>
>>> intersects gives me:
>>> false
>>>
>>> but when I see the line drawn on map I see both lines intersect in a
>>> little "section" (strectch). But really when I use intersects or
>>> intersection functions gives me "unavailable intersection"... and when I
>>> use OVERLAPS function
>>> overlaps(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001)) also
>>> gives me "false".
>>>
>>> Another ideas please??
>>>
>>>
>>> 2013/11/22 James David Smith 
>>>
 Hi Ani,

 Have you looked into st_intersects() ? and st_intersection() ?

 http://postgis.refractions.net/docs/ST_Intersects.html

 James

 On 22 November 2013 16:17, Ani Alamo  wrote:
 > Hi!
 > I need a specific function to get if two linestring overlaps. e.g.
 > Linestring 1 is Point (0, 0) : Point (10, 0) Linestring 2 is Point
 (0, 0) :
 > Point (3, 0)
 >
 > In this case I need "true" result because LineString 1 overlaps in
 different
 > points like 0,0 1,0 2,0 & 3,0. I dont need the common points, I only
 need if
 > two linestring overlaps or not. I tried with this function in
 postgis...
 >
 > overlaps(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001))
 > I create a buffer on both linestrings... but muy problem is some
 times works
 > better, some times not.
 >
 > Can you help me please?
 >
 > Thanks!
 >
 > ___
 > postgis-users mailing list
 > postgis-users@lists.osgeo.org
 > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
 ___
 postgis-users mailing list
 postgis-users@lists.osgeo.org
 http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

>>>
>>>
>>
>> ___
>> postgis-users mailing list
>> postgis-users@lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>
>
>
___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Re: [postgis-users] Postgis overlapping two linestrings

2013-11-23 Thread Martin Feuchtwanger

  
  
ST_Relate() is an interesting and versatile function: http://postgis.org/docs/ST_Relate.html
(also illustrated at http://workshops.boundlessgeo.com/postgis-intro/de9im.html
)

But maybe your problem is one of tolerance/roundoff-error

On 22/11/2013 8:17 AM, Ani Alamo wrote:


  
Hi!
I
  need a specific function to get if two linestring overlaps.
  e.g. Linestring 1 is Point (0, 0) : Point (10, 0) Linestring 2
  is Point (0, 0) : Point (3, 0)

In
  this case I need "true" result because LineString 1 overlaps
  in different points like 0,0 1,0 2,0 & 3,0. I dont need
  the common points, I only need if two linestring overlaps or
  not. I tried with this function in postgis...

overlaps(buffer(LINESTRING1,
  0.001), buffer(LINESTRING2, 0.001))
I
  create a buffer on both linestrings... but muy problem is some
  times works better, some times not.

Can
  you help me please?

Thanks!
  
  
  
  
  ___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


-- 
  Martin Feuchtwanger   feu...@shaw.ca   
Vancouver, BC   V5N 1J6

http://members.shaw.ca/geomatics.developer

  

  

___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Re: [postgis-users] Postgis overlapping two linestrings

2013-11-24 Thread Mike Toews
On 23 November 2013 05:50, Ani Alamo  wrote:
> Uhm... exactly I have this linestrings:
> LINESTRING(2.118932325 41.398745991,2.168720219 41.385631938)
> LINESTRING(2.142346041 41.398526436,2.81541 41.409216161)
>
> intersections gives me:
> GeometryCollection: GEOMETRYCOLLECTION EMPTY
>
> intersects gives me:
> false
>
> but when I see the line drawn on map I see both lines intersect in a little
> "section" (strectch).

No, these lines don't intersect, they are somewhat parallel to each
other, but not at all even close to touching. You might be confusing
another pair of lines.

> But really when I use intersects or intersection
> functions gives me "unavailable intersection"... and when I use OVERLAPS
> function
> overlaps(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001)) also gives
> me "false".
>
> Another ideas please??

Avoid using buffer for proximity analysis. Try using ST_DWithin instead:

SELECT
  ST_Distance(A::geography, B::geography) AS dist_m,
  ST_Distance(A::geometry, B::geometry) AS dist,
  ST_DWithin(A::geography, B::geography, 700) AS within_m,
  ST_DWithin(A::geometry, B::geometry, 0.006) AS within
FROM
(SELECT
 'LINESTRING (2.118932325 41.398745991, 2.168720219 41.385631938)'::text AS A,
 'LINESTRING (2.142346041 41.398526436, 2.81541 41.409216161)'::text as B
) as f;

-[ RECORD 1 ]-
dist_m   | 623.162866494591
dist | 0.00575141350513493
within_m | t
within   | t


-Mike
___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users