Gis Tricks

Getting begin and endnodes in postgis

Getting begin and endnodes in postgis

If you need to find endpoints for each line that you have, the query below can be helpful:

-- find endpoints of each connection

drop table if exists connections_endpoints;

create table connections_endpoints AS

select point as geom

FROM (Select ST_StartPoint(geom) as point

FROM lines


Select ST_EndPoint(geom) as point

FROM lines) as a

GROUP BY point

HAVING count(*) = 1

Leave a Reply

Your email address will not be published. Required fields are marked *

nine + six =