Package org.h2gis.functions.io.osm

## Class OSMTablesFactory

- java.lang.Object
- - org.h2gis.functions.io.osm.OSMTablesFactory

    public class OSMTablesFactory
    extends Object

Class to create the tables to import osm data An OSM file is stored in 10 tables. (1) table_prefix + _node : table that contains all nodes, (2) table_prefix + _node_tag : table that contains a list of tags (key, value) for each node, (3) table_prefix + _way : table that contains all ways with their geometries, (4) table_prefix + _way_tag : table that contains a list of tags (key, value) for each way, (5) table_prefix + _way_node : table that contains the list of nodes used to represent a way, (6) table_prefix + _relation: table that contains all relations, (7) table_prefix + _relation_tag : table that contains a list of tags (key, value) for each relation, (8) table_prefix + _node_member : table that stores all nodes that are referenced into a relation, (9) table_prefix + _way_member : table that stores all ways that are referenced into a relation, (10) table_prefix + _relation_member : table that stores all relations that are referenced into a relation.

Author:
  Erwan Bocher

### Field Summary

Fields
`static String` `NODE`
`static String` `NODE_MEMBER`
`static String` `NODE_TAG`
`static String` `RELATION`
`static String` `RELATION_MEMBER`
`static String` `RELATION_TAG`
`static String` `WAY`
`static String` `WAY_MEMBER`
`static String` `WAY_NODE`
`static String` `WAY_TAG`

### Method Summary

All Methods Static Methods Concrete Methods
`static PreparedStatement` `createNodeMemberTable​(Connection connection, String nodeMemberTable)` Create the node members table
`static PreparedStatement` `createNodeTable​(Connection connection, String nodeTableName)` Create the nodes table that will be used to import OSM nodes Example : `<node id="298884269" lat="54.0901746" lon="12.2482632" user="SvenHRO" uid="46882" visible="true" version="1" changeset="676636" timestamp="2008-09-21T21:37:45Z"/>`
`static PreparedStatement` `createNodeTagTable​(Connection connection, String nodeTagTableName)` Create a table to store the node tags.
`static PreparedStatement` `createRelationMemberTable​(Connection connection, String relationMemberTable)` Store all relation members
`static PreparedStatement` `createRelationTable​(Connection connection, String relationTable)` Create the relation table.
`static PreparedStatement` `createRelationTagTable​(Connection connection, String relationTagTable)` Create the relation tags table
`static PreparedStatement` `createWayMemberTable​(Connection connection, String wayMemberTable)` Create a table to store all way members.
`static PreparedStatement` `createWayNodeTable​(Connection connection, String wayNodeTableName)` Create a table to store the list of nodes for each way.
`static PreparedStatement` `createWayTable​(Connection connection, String wayTableName)` Create the ways table that will be used to import OSM ways Example : `<way id="26659127" user="Masch" uid="55988" visible="true" version="5" changeset="4142606" timestamp="2010-03-16T11:47:08Z">`
`static PreparedStatement` `createWayTagTable​(Connection connection, String wayTagTableName)` Create a table to store the way tags.
`static void` `dropOSMTables​(Connection connection, String tablePrefix)` Drop the existing OSM tables used to store the imported OSM data

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### NODE

    public static final String NODE

See Also:
  Constant Field Values

#### WAY

    public static final String WAY

See Also:
  Constant Field Values

#### NODE_TAG

    public static final String NODE_TAG

See Also:
  Constant Field Values

#### WAY_TAG

    public static final String WAY_TAG

See Also:
  Constant Field Values

#### WAY_NODE

    public static final String WAY_NODE

See Also:
  Constant Field Values

#### RELATION

    public static final String RELATION

See Also:
  Constant Field Values

#### RELATION_TAG

    public static final String RELATION_TAG

See Also:
  Constant Field Values

#### NODE_MEMBER

    public static final String NODE_MEMBER

See Also:
  Constant Field Values

#### WAY_MEMBER

    public static final String WAY_MEMBER

See Also:
  Constant Field Values

#### RELATION_MEMBER

    public static final String RELATION_MEMBER

See Also:
  Constant Field Values

### Method Detail

#### createNodeTable

    public static PreparedStatement createNodeTable​(Connection connection,
                                                    String nodeTableName)
                                             throws SQLException

Create the nodes table that will be used to import OSM nodes Example : `<node id="298884269" lat="54.0901746" lon="12.2482632" user="SvenHRO" uid="46882" visible="true" version="1" changeset="676636" timestamp="2008-09-21T21:37:45Z"/>`

Parameters:
  `connection` - database
  `nodeTableName` - table name
Returns:
  PreparedStatement
Throws:
  `SQLException`

#### createNodeTagTable

    public static PreparedStatement createNodeTagTable​(Connection connection,
                                                       String nodeTagTableName)
                                                throws SQLException

Create a table to store the node tags.

Parameters:
  `connection` - database
  `nodeTagTableName` - table name
Returns:
  PreparedStatement
Throws:
  `SQLException`

#### createWayTable

    public static PreparedStatement createWayTable​(Connection connection,
                                                   String wayTableName)
                                            throws SQLException

Create the ways table that will be used to import OSM ways Example : `<way id="26659127" user="Masch" uid="55988" visible="true" version="5" changeset="4142606" timestamp="2010-03-16T11:47:08Z">`

Parameters:
  `connection` - database
  `wayTableName` - table name
Returns:
  PreparedStatement
Throws:
  `SQLException`

#### createWayTagTable

    public static PreparedStatement createWayTagTable​(Connection connection,
                                                      String wayTagTableName)
                                               throws SQLException

Create a table to store the way tags.

Parameters:
  `connection` - database
  `wayTagTableName` - table name
Returns:
  PreparedStatement
Throws:
  `SQLException`

#### createWayNodeTable

    public static PreparedStatement createWayNodeTable​(Connection connection,
                                                       String wayNodeTableName)
                                                throws SQLException

Create a table to store the list of nodes for each way.

Parameters:
  `connection` - database
  `wayNodeTableName` - table name
Returns:
  PreparedStatement
Throws:
  `SQLException`

#### createRelationTable

    public static PreparedStatement createRelationTable​(Connection connection,
                                                        String relationTable)
                                                 throws SQLException

Create the relation table.

Parameters:
  `connection` - database
  `relationTable` - table name
Returns:
  PreparedStatement
Throws:
  `SQLException`

#### createRelationTagTable

    public static PreparedStatement createRelationTagTable​(Connection connection,
                                                           String relationTagTable)
                                                    throws SQLException

Create the relation tags table

Parameters:
  `connection` - database
  `relationTagTable` - table name
Returns:
  PreparedStatement
Throws:
  `SQLException`

#### createNodeMemberTable

    public static PreparedStatement createNodeMemberTable​(Connection connection,
                                                          String nodeMemberTable)
                                                   throws SQLException

Create the node members table

Parameters:
  `connection` - database
  `nodeMemberTable` - table name
Returns:
  PreparedStatement
Throws:
  `SQLException`

#### createWayMemberTable

    public static PreparedStatement createWayMemberTable​(Connection connection,
                                                         String wayMemberTable)
                                                  throws SQLException

Create a table to store all way members.

Parameters:
  `connection` - database
  `wayMemberTable` - table name
Returns:
  PreparedStatement
Throws:
  `SQLException`

#### createRelationMemberTable

    public static PreparedStatement createRelationMemberTable​(Connection connection,
                                                              String relationMemberTable)
                                                       throws SQLException

Store all relation members

Parameters:
  `connection` - database
  `relationMemberTable` - table name
Returns:
  PreparedStatement
Throws:
  `SQLException`

#### dropOSMTables

    public static void dropOSMTables​(Connection connection,
                                     String tablePrefix)
                              throws SQLException

Drop the existing OSM tables used to store the imported OSM data

Parameters:
  `connection` - database
  `tablePrefix` - table prefix
Throws:
  `SQLException`