org.h2gis.h2spatialext.function.spatial.graph
Class ST_Graph

java.lang.Object
  extended by org.h2gis.h2spatialapi.AbstractFunction
      extended by org.h2gis.h2spatialext.function.spatial.graph.ST_Graph
All Implemented Interfaces:
Function, ScalarFunction

public class ST_Graph
extends AbstractFunction
implements ScalarFunction

Assigns integer node and edge ids to LINESTRING or MULTILINESTRING geometries from a table named input, resulting in two new tables: input_nodes and input_edges.

Author:
Adam Gouge, Erwan Bocher

Field Summary
static String ALREADY_RUN_ERROR
           
static String REMARKS
           
static String TYPE_ERROR
           
 
Fields inherited from interface org.h2gis.h2spatialapi.ScalarFunction
PROP_DETERMINISTIC, PROP_NOBUFFER
 
Fields inherited from interface org.h2gis.h2spatialapi.Function
PROP_NAME, PROP_REMARKS
 
Constructor Summary
ST_Graph()
          Constructor
 
Method Summary
static boolean createGraph(Connection connection, String tableName)
          Create the nodes and edges tables from the input table containing LINESTRINGs or MULTILINESTRINGs.
static boolean createGraph(Connection connection, String tableName, String spatialFieldName)
          Create the nodes and edges tables from the input table containing LINESTRINGs or MULTILINESTRINGs in the given column.
static boolean createGraph(Connection connection, String tableName, String spatialFieldName, double tolerance)
          Create the nodes and edges tables from the input table containing LINESTRINGs or MULTILINESTRINGs in the given column and using the given tolerance.
static boolean createGraph(Connection connection, String inputTable, String spatialFieldName, double tolerance, boolean orientBySlope)
          Create the nodes and edges tables from the input table containing LINESTRINGs or MULTILINESTRINGs in the given column and using the given tolerance, and potentially orienting edges by slope.
 String getJavaStaticMethod()
           
 
Methods inherited from class org.h2gis.h2spatialapi.AbstractFunction
addProperty, getProperty, removeProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.h2gis.h2spatialapi.Function
getProperty
 

Field Detail

REMARKS

public static final String REMARKS
See Also:
Constant Field Values

TYPE_ERROR

public static final String TYPE_ERROR
See Also:
Constant Field Values

ALREADY_RUN_ERROR

public static final String ALREADY_RUN_ERROR
See Also:
Constant Field Values
Constructor Detail

ST_Graph

public ST_Graph()
Constructor

Method Detail

getJavaStaticMethod

public String getJavaStaticMethod()
Specified by:
getJavaStaticMethod in interface ScalarFunction

createGraph

public static boolean createGraph(Connection connection,
                                  String tableName)
                           throws SQLException
Create the nodes and edges tables from the input table containing LINESTRINGs or MULTILINESTRINGs.

Since no column is specified in this signature, we take the first geometry column we find.

If the input table has name 'input', then the output tables are named 'input_nodes' and 'input_edges'.

Parameters:
connection - Connection
tableName - Input table containing LINESTRINGs or MULTILINESTRINGs
Returns:
true if both output tables were created
Throws:
SQLException

createGraph

public static boolean createGraph(Connection connection,
                                  String tableName,
                                  String spatialFieldName)
                           throws SQLException
Create the nodes and edges tables from the input table containing LINESTRINGs or MULTILINESTRINGs in the given column.

If the input table has name 'input', then the output tables are named 'input_nodes' and 'input_edges'.

Parameters:
connection - Connection
tableName - Input table
spatialFieldName - Name of column containing LINESTRINGs or MULTILINESTRINGs
Returns:
true if both output tables were created
Throws:
SQLException

createGraph

public static boolean createGraph(Connection connection,
                                  String tableName,
                                  String spatialFieldName,
                                  double tolerance)
                           throws SQLException
Create the nodes and edges tables from the input table containing LINESTRINGs or MULTILINESTRINGs in the given column and using the given tolerance.

The tolerance value is used specify the side length of a square Envelope around each node used to snap together other nodes within the same Envelope. Note, however, that edge geometries are left untouched. Note also that coordinates within a given tolerance of each other are not necessarily snapped together. Only the first and last coordinates of a geometry are considered to be potential nodes, and only nodes within a given tolerance of each other are snapped together. The tolerance works only in metric units.

If the input table has name 'input', then the output tables are named 'input_nodes' and 'input_edges'.

Parameters:
connection - Connection
tableName - Input table
spatialFieldName - Name of column containing LINESTRINGs or MULTILINESTRINGs
tolerance - Tolerance
Returns:
true if both output tables were created
Throws:
SQLException

createGraph

public static boolean createGraph(Connection connection,
                                  String inputTable,
                                  String spatialFieldName,
                                  double tolerance,
                                  boolean orientBySlope)
                           throws SQLException
Create the nodes and edges tables from the input table containing LINESTRINGs or MULTILINESTRINGs in the given column and using the given tolerance, and potentially orienting edges by slope.

The tolerance value is used specify the side length of a square Envelope around each node used to snap together other nodes within the same Envelope. Note, however, that edge geometries are left untouched. Note also that coordinates within a given tolerance of each other are not necessarily snapped together. Only the first and last coordinates of a geometry are considered to be potential nodes, and only nodes within a given tolerance of each other are snapped together. The tolerance works only in metric units.

The boolean orientBySlope is set to true if edges should be oriented by the z-value of their first and last coordinates (decreasing).

If the input table has name 'input', then the output tables are named 'input_nodes' and 'input_edges'.

Parameters:
connection - Connection
inputTable - Input table
spatialFieldName - Name of column containing LINESTRINGs or MULTILINESTRINGs
tolerance - Tolerance
orientBySlope - True if edges should be oriented by the z-value of their first and last coordinates (decreasing)
Returns:
true if both output tables were created
Throws:
SQLException


Copyright © 2015 IRSTV CNRS-FR-2488. All Rights Reserved.