[postgis-users] Point and intersection of streets.

Stephen Woodbridge woodbri at swoodbridge.com
Tue Aug 24 14:00:16 PDT 2010


You might try something like:

select a.gid, b.gid,
        distance(makepoint(x,y), st_intersection(a.the_geom, b.the_geom)
          as dist
   from lines a, lines b
  where st_expand(makepoint(x,y), max_dist) && a.the_geom and
        st_expand(makepoint(x,y), max_dist) && b.the_geom and
        st_intersects(a.the_geom, b.the_geom);

You will like need to change this based on whatever SRID you are using.

I have not tried this, but maybe it will get you started.

-Steve

PS: please keep the list CC on this, there are other that can help and 
profit from the responses.


On 8/24/2010 1:34 PM, vilella.ricardo at gmail.com wrote:
> My data isn't noded and when I said "near" is by a maximun distance. If
> I had a line A and line B how I can do to know if a point is near of the
> intersection of this lines?
>
> El 24/08/2010 14:04, Stephen Woodbridge <woodbri at swoodbridge.com> escribió:
>  > On 8/24/2010 11:19 AM, Ricardo Vilella wrote:
>  >
>  >
>  > I have a layer with lines representing the streets of a city, how I can
>  >
>  > do to find if a point is near an intersection of two streets?
>  >
>  >
>  >
>  >
>  > I think we need a little more information:
>  >
>  >
>  >
>  > How do you want to define "near"? by some maximum distance?
>  >
>  > What is an intersection?
>  >
>  > A. if you data is noded, then intersections are defined by a node
> that has two or more segments with different names.
>  >
>  > B. if not noded then you have compute all the segment segment
> intersections in the area "near" the point.
>  >
>  >
>  >
>  > -Steve
>  >




More information about the postgis-users mailing list