[postgis-users] Count the roads that do not intersect with any other roads in the shpefile.

Nicklas Avén nicklas.aven at jordogskog.no
Mon Jan 10 02:24:54 PST 2011


and to get the number found, just use count()

/Nicklas


On Mon, 2011-01-10 at 11:23 +0100, Nicklas Avén wrote:
> Hallo Nicholas
> 
> I assume you mean that you hae your data in a postgis table not in
> shapefile.
> 
> to find all roads that doesn't intersect any other road you find all
> roads that do intersect and than catch the ones didn't find any
> intersecton.
> 
> something like
> 
> SELECT a.gid, a.the_geom FROM mytable a LEFT JOIN mytable b on
> ST_Intersects(a.the_geom, b.the_geom) WHERE a.gid != b.gid and b.gid IS
> NULL;
> 
> Because of the left join you will get the records in table a that has no
> intersection with any other road. And those cases can be detected
> because then there will be only null in id field from table b.
> 
> 
> HTH
> 
> Nicklas
> 
> 
> On Mon, 2011-01-10 at 15:11 +0530, Nicholas I wrote:
> > Hi,
> > 
> >  I am trying to find the roads, where the roads does not intersect
> > with any other roads in the shapefile.
> > Can some one help me.
> > 
> > thank you
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 





More information about the postgis-users mailing list