Geospatial Modelling Environment

graph.createfrompoints (Generate Spatial Graph From Points)

Creates a spatial graph by connecting points based on a distance threshold, and exports node and edge data that can be imported into R


This tool converts a point dataset representing graph nodes to a spatial graph by connecting nodes automatically using a distance threshold. The edges are output as a line feature dataset, and the nodes and edges are export as two delimited text files that can be easily read into R. The unique point ID field is preserved in the exported node data so that the connection with the original point data can be preserved. An optional node wieght field can also be specified, which results in an extra column of data being written to the export file.

The graph can be created in R using the igraph library as follows.



edata <- read.csv(“exportedges.csv”)

ndata <- read.csv(“exportnodes.csv”)

graph1 <-[,-1], directed=FALSE, vertices=NULL)


graph.createfrompoints(in, uidfield, distance, outline, exportnode, exportedge, [nodeweightfield], [where]);

inthe input point data source that represents graph nodes
uidfieldthe unique feature ID field for the input data source
distancethe threshold distance for connecting nodes
outlinethe output line feature data source
exportnodethe graph node export csv file
exportedgethe graph edge export csv file
[nodeweightfield]a field name containing node weights to be included in the export file)
[where]the selection statement that will be applied to the input feature data source to identify a subset of features to process (see full Help documentation for further details)


graph.createfrompoints(in=”C:datapoints.shp”, uidfield=”PNTID”, outline=”C:datagraphedges.shp”, exportnode=”C:dataexportnodes.csv”, exportedge=”C:dataexportedges.shp”);

graph.createfrompoints(in=”C:datapatchpolygons.shp”, uidfield=”PATCHID”, outline=”C:datagraphedges.shp”, exportnode=”C:dataexportnodes.csv”, exportedge=”C:dataexportedges.shp”, nodeweightfield=”POPULATION”, where=”POPULATION > 0″);


Please consider making a purchase to support the continued development of these tools  Read more...

Tips on how to use this interface efficiently 


Open Source GIS

Copyright © 2001-2014 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn