[postgis-users] Line within range of another line?
Ahmet Temiz
ahmettemiz88 at gmail.com
Mon Oct 31 00:58:55 PDT 2016
Thank you,
It was great help.
Later, I had built this:
---
WITH faultbuffer as (
SELECT gid,ST_Union(St_Buffer(the_geom,100)) as geom from fault4analyse
group by gid
)
SELECT road.gid,ST_Intersection(road.the_geom,faultbuffer.geom ) as
road_fayBuffer from road4analyse as road , faultbuffer
WHERE ST_Intersects(road.the_geom, faultbuffer.geom )
---
and it is reasonably fast.
Does it do same thing you have offered ?
kind regards
On Sun, Oct 30, 2016 at 10:55 AM, Regina Obe <lr at pcorp.us> wrote:
> Use ST_DWithin (works for both geography and geometry) and any kind of
> geometry, not just lines .
>
> My example is for geography since units are always in meters. For
> geometry units you have to specify based on your spatial_ref_sys and
> geometries have to have same spatial ref sys
>
>
>
> something like below will return all roads that are within 100 meters of a
> fault line
>
>
>
> SELECT l.gid, l.geog
>
> FROM roads As l
>
> WHERE EXISTS (SELECT 1 FROM fault_lines As fl WHERE ST_DWithin(fl.geog,
> l.geog, 100) );
>
>
>
> If you need to know the exact fault lines, do a JOIN instead – keep in
> mind if a road is close enough to more than one fault line, it will be
> duplicated
>
>
>
> SELECT l.gid, l.geog, fl.name, ST_Distance(l.geog, fl.geog) AS dist
>
> FROM roads AS l INNER JOIN fault_lines AS fl ON (ST_DWithin(fl.geog,
> l.geog, 100) );
>
>
>
>
>
>
>
> If you want jus the closes fault line within 100 meters use DISTINCT ON
>
>
>
> SELECT DISTINCT ON(l.gid) l.gid, l.geog, fl.name, ST_Distance(l.geog,
> fl.geog) AS dist
>
> FROM roads AS l INNER JOIN fault_lines AS fl ON (ST_DWithin(fl.geog,
> l.geog, 100) )
>
> ORDER BY l.gid, dist;
>
>
>
>
>
>
>
> Hope that helps,
>
> Regina
>
> http://www.postgis.us
>
> http://www.paragoncorporation.com
>
>
>
> http://postgis.net
>
>
>
>
>
> *From:* postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] *On
> Behalf Of *Ahmet Temiz
> *Sent:* Sunday, October 30, 2016 2:59 AM
> *To:* PostGIS Users Discussion <postgis-users at lists.osgeo.org>; PostGIS
> Users Discussion <postgis-users at postgis.refractions.net>
> *Subject:* [postgis-users] Line within range of another line?
>
>
>
> Hi,
>
> How can I find Line within range of another line?
>
> I mean I try to find line section within certain range of another line.
>
> For example, road lines close to fault lines.
>
>
>
> Ps : I know that using st_buffer causes performance issue.
>
> Can you give any advice?
>
>
>
> Regards
>
>
>
>
>
> --
>
> Ahmet Temiz
> Jeoloji Müh.
> Afet ve Acil Durum Yönetimi Başkanlığı
> Bilgi İşlem Dairesi Başkanlığı-CBS Grubu
>
>
> ________________________
>
> Ahmet Temiz
> Geological Eng.
> Information Systems - GIS Group
> Disaster and Emergency Management
> of Presidency
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-users
>
--
Ahmet Temiz
Jeoloji Müh.
Afet ve Acil Durum Yönetimi Başkanlığı
Bilgi İşlem Dairesi Başkanlığı-CBS Grubu
________________________
Ahmet Temiz
Geological Eng.
Information Systems - GIS Group
Disaster and Emergency Management
of Presidency
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20161031/30220e5e/attachment.html>
More information about the postgis-users
mailing list