[gdal-dev] creating graph for single line shape layer using gdal gnm

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Thu Nov 13 00:26:53 PST 2014


Mikhail Gusev <gusevmihs <at> gmail.com> writes:


> 
> Is it correct to do this way?First I will save point layer using 
> start and end points of line  layer.Again then connect the two layers 
> using autoconnect method . So that I can find shortest path between 
> features of the line layer.
> 
> hema,
> yes it's correct, but note, that there must be only one point in a
junction of two line ends in order the connection will be made correct. 


Hi,

You can create such point shapefile from a line shapefile with ogr2ogr by
utilizing Spatialite:

ogr2ogr -f "ESRI Shapefile" nodes.shp lines.shp -dialect sqlite -sql "SELECT
ST_StartPoint(geometry) AS node_geometry FROM lines UNION SELECT
ST_EndPoint(geometry) AS node_geometry FROM lines"

-Jukka Rahkonen-



More information about the gdal-dev mailing list