Creates a map matching workspace based on the topological network data stored in your relational tables for road matching.
Syntax
boolean ST_CreateWorkspace(text wsname, text sql);Parameters
Parameter | Description |
wsname | The name of the workspace. The name must be unique. |
sql | The SQL statement that is used to construct the topological network of the workspace in memory. |
Return values
Return value | Description |
t | The creation was successful. |
f | The creation failed. |
Description
The map matching workspace includes in-memory map topological network data. You must create or load the map topological network data before you can perform road matching.
The name of the workspace must be unique. You can view existing workspaces in the
mapmatching_workspacetable.The SQL query result used to build a workspace must contain four fields:
id: the unique identifier of the edge. The type is SMALLINT, INTEGER, or BIGINT.
source: the identifier of the source node of the edge. The type is SMALLINT, INTEGER, or BIGINT.
target: the identifier of the destination node of the edge. The type is SMALLINT, INTEGER, or BIGINT.
geometry: the geometrical information of the edge. The type is GEOMETRY. Only the LineString and MultiLineString types are supported. If the geometry type is MultiLineString, only the first child LineString object is used.
The unit of the constructed topological network is the map unit. If coordinate conversion is required, use the ST_Transform function.
Examples
Prepare road network data and build a road network topology. For more information, see Example 1.
Build a workspace.
All objects are used to build a workspace.
SELECT ST_CreateWorkspace('mm_ws_test1', 'select fid, source, target, geom from network');Only filtered objects are used to build a workspace.
SELECT ST_CreateWorkspace('mm_ws_test2', $$ select fid, source, target, geom from network where fid > 10 $$);View the created workspace.
SELECT * from mapmatching_workspace;Sample result:
ws_id | ws_name | ws_sql | ws_options -------+-------------+----------------------------------------------------------------+------------ 1 | mm_ws_test1 | select fid, source, target, geom from network | 2 | mm_ws_test2 | select fid, source, target, geom from network where fid > 10 | (2 rows)