pgRouting Manual (2.2)

pgr_flipEdges

«  pgr_pointToEdgeNode   ::   Contents   ::   pgr_textToPoints  »

pgr_flipEdges

Name

pgr_flipEdges -

Warning

This is a proposed function

  • Is not officially in the release.
  • Name could change.
  • Signature could change.
  • Needs testing.
  • Functionality could change.

Synopsis

The function returns:

  • geometry[] An array of the input geometries with the geometries flipped end to end such that the geometries are oriented as a path from start to end.
geometry[] pgr_flipEdges(ga geometry[])

Description

Given an array of linestrings that are supposedly connected end to end like the results of a route, check the edges and flip any end for end if they do not connect with the previous seegment and return the array with the segments flipped as appropriate.

Parameters

ga:geometry[] An array of geometries, like the results of a routing query.

Warning

  • No checking is done for edges that do not connect.
  • Input geometries MUST be LINESTRING or MULTILINESTRING.
  • Only the first LINESTRING of a MULTILINESTRING is considered.

History

  • Proposed in version 2.1.0

Examples

SELECT st_astext(e) FROM (SELECT unnest(pgr_flipedges(ARRAY[
'LINESTRING(2 1,2 2)'::geometry,
'LINESTRING(2 2,2 3)'::geometry,
'LINESTRING(2 2,2 3)'::geometry,
'LINESTRING(2 2,3 2)'::geometry,
'LINESTRING(3 2,4 2)'::geometry,
'LINESTRING(4 1,4 2)'::geometry,
'LINESTRING(3 1,4 1)'::geometry,
'LINESTRING(2 1,3 1)'::geometry,
'LINESTRING(2 0,2 1)'::geometry,
'LINESTRING(2 0,2 1)'::geometry]::geometry[])) AS e) AS foo;
      st_astext      
---------------------
 LINESTRING(2 1,2 2)
 LINESTRING(2 2,2 3)
 LINESTRING(2 3,2 2)
 LINESTRING(2 2,3 2)
 LINESTRING(3 2,4 2)
 LINESTRING(4 2,4 1)
 LINESTRING(4 1,3 1)
 LINESTRING(3 1,2 1)
 LINESTRING(2 1,2 0)
 LINESTRING(2 0,2 1)
(10 rows)

See also

Indices and tables

«  pgr_pointToEdgeNode   ::   Contents   ::   pgr_textToPoints  »