GME

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

Description

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.

setwd("C:\\gme\\mygraphdata")

require(igraph)

edata <- read.csv("exportedges.csv")

ndata <- read.csv("exportnodes.csv")

graph1 <- graph.data.frame(edata[,-1], directed=FALSE, vertices=NULL)

Syntax

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)

Example

graph.createfrompoints(in="C:\data\points.shp", uidfield="PNTID", outline="C:\data\graphedges.shp", exportnode="C:\data\exportnodes.csv", exportedge="C:\data\exportedges.shp");

graph.createfrompoints(in="C:\data\patchpolygons.shp", uidfield="PATCHID", outline="C:\data\graphedges.shp", exportnode="C:\data\exportnodes.csv", exportedge="C:\data\exportedges.shp", nodeweightfield="POPULATION", where="POPULATION > 0");


Messages

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

Tips on how to use this interface efficiently  Read more...

Links

Open Source GIS

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