Class ST_Graph
- java.lang.Object
-
- org.h2gis.api.AbstractFunction
-
- org.h2gis.functions.spatial.topology.ST_Graph
-
- All Implemented Interfaces:
org.h2gis.api.Function,org.h2gis.api.ScalarFunction
public class ST_Graph extends org.h2gis.api.AbstractFunction implements org.h2gis.api.ScalarFunctionAssigns 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
Fields Modifier and Type Field Description static StringALREADY_RUN_ERRORstatic StringCOORDS_TABLEstatic StringEDGES_SUFFIXstatic StringNODES_SUFFIXstatic StringPTS_TABLEstatic StringREMARKSstatic StringTYPE_ERROR
-
Constructor Summary
Constructors Constructor Description ST_Graph()Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleancreateGraph(Connection connection, String tableName)Create the nodes and edges tables from the input table containing LINESTRINGs.static booleancreateGraph(Connection connection, String inputTable, String spatialFieldName, double tolerance, boolean orientBySlope)Create the nodes and edges tables from the input table containing LINESTRINGs in the given column and using the given tolerance, and potentially orienting edges by slope.static booleancreateGraph(Connection connection, String inputTable, String spatialFieldName, double tolerance, boolean orientBySlope, boolean deleteTables)Create the nodes and edges tables from the input table containing LINESTRINGs in the given column and using the given tolerance, and potentially orienting edges by slope.static booleancreateGraph(Connection connection, String inputTable, String spatialFieldName, double tolerance, boolean orientBySlope, boolean deleteTables, ArrayList<String> columns)Create the nodes and edges tables from the input table containing LINESTRINGs in the given column and using the given tolerance, and potentially orienting edges by slope.static booleancreateGraph(Connection connection, String tableName, org.h2.value.Value value)Create the nodes and edges tables from the input table containing LINESTRINGs in the given column.static booleancreateGraph(Connection connection, String tableName, org.h2.value.Value secondValue, org.h2.value.Value thirdValue)Create the nodes and edges tables from the input table containing LINESTRINGs in the given column and using the given tolerance.StringgetJavaStaticMethod()-
Methods inherited from class org.h2gis.api.AbstractFunction
addProperty, getProperty, removeProperty
-
-
-
-
Field Detail
-
NODES_SUFFIX
public static final String NODES_SUFFIX
- See Also:
- Constant Field Values
-
EDGES_SUFFIX
public static final String EDGES_SUFFIX
- See Also:
- Constant Field Values
-
PTS_TABLE
public static String PTS_TABLE
-
COORDS_TABLE
public static String COORDS_TABLE
-
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
-
-
Method Detail
-
getJavaStaticMethod
public String getJavaStaticMethod()
- Specified by:
getJavaStaticMethodin interfaceorg.h2gis.api.ScalarFunction
-
createGraph
public static boolean createGraph(Connection connection, String tableName) throws SQLException
Create the nodes and edges tables from the input table containing LINESTRINGs. 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- ConnectiontableName- Input table containing LINESTRINGs- Returns:
- true if both output tables were created
- Throws:
SQLException
-
createGraph
public static boolean createGraph(Connection connection, String tableName, org.h2.value.Value value) throws SQLException
Create the nodes and edges tables from the input table containing LINESTRINGs in the given column. If the input table has name 'input', then the output tables are named 'input_nodes' and 'input_edges'.- Parameters:
connection- ConnectiontableName- Input tablevalue- Name of column containing LINESTRINGs or an array of columns- Returns:
- true if both output tables were created
- Throws:
SQLException
-
createGraph
public static boolean createGraph(Connection connection, String tableName, org.h2.value.Value secondValue, org.h2.value.Value thirdValue) throws SQLException
Create the nodes and edges tables from the input table containing LINESTRINGs 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- ConnectiontableName- Input tablesecondValue- Name of column containing LINESTRINGsthirdValue- 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 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- ConnectioninputTable- Input tablespatialFieldName- Name of column containing LINESTRINGstolerance- ToleranceorientBySlope- 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
-
createGraph
public static boolean createGraph(Connection connection, String inputTable, String spatialFieldName, double tolerance, boolean orientBySlope, boolean deleteTables) throws SQLException
Create the nodes and edges tables from the input table containing LINESTRINGs 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- ConnectioninputTable- Input tablespatialFieldName- Name of column containing LINESTRINGstolerance- ToleranceorientBySlope- True if edges should be oriented by the z-value of their first and last coordinates (decreasing)deleteTables- True delete the existing tables- 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, boolean deleteTables, ArrayList<String> columns) throws SQLException
Create the nodes and edges tables from the input table containing LINESTRINGs 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- ConnectioninputTable- Input tablespatialFieldName- Name of column containing LINESTRINGstolerance- ToleranceorientBySlope- True if edges should be oriented by the z-value of their first and last coordinates (decreasing)deleteTables- True delete the existing tablescolumns- an array of columns to keep- Returns:
- true if both output tables were created
- Throws:
SQLException
-
-