Skip to content

New function pgr_findCloseEdges #2318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 20, 2022

Conversation

cvvergara
Copy link
Member

@cvvergara cvvergara commented Jun 18, 2022

Fixes #2317

Changes proposed in this pull request:
SQL only function with 2 signatures one for one point and another for many points

pgr_findCloseEdges(Edges SQL, point, tolerance  [cap, partial, dryrun])
pgr_findCloseEdges(Edges SQL, points, tolerance  [cap, partial, dryrun])
RETURNS SET OF (edge_id, fraction side, distance, geom, edge)
OR EMPTY SET

The functions are ready to use with any withPoints function:

SELECT * FROM pgr_withPoints(
  $e$ SELECT * FROM edges $e$,
  $p$ SELECT edge_id, round(fraction::numeric, 2) AS fraction, side
      FROM pgr_findCloseEdges(
        $$SELECT id, geom FROM edges$$,
        (SELECT geom FROM pointsOfInterest WHERE pid = 5),
        0.5, cap => 2)
  $p$,
  1, ARRAY[-1, -2]);
 seq | path_seq | end_pid | node | edge | cost | agg_cost
-----+----------+---------+------+------+------+----------
   1 |        1 |      -2 |    1 |    6 |    1 |        0
   2 |        2 |      -2 |    3 |    7 |    1 |        1
   3 |        3 |      -2 |    7 |    8 |  0.9 |        2
   4 |        4 |      -2 |   -2 |   -1 |    0 |      2.9
   5 |        1 |      -1 |    1 |    6 |    1 |        0
   6 |        2 |      -1 |    3 |    7 |    1 |        1
   7 |        3 |      -1 |    7 |    8 |    1 |        2
   8 |        4 |      -1 |   11 |    9 |    1 |        3
   9 |        5 |      -1 |   16 |   16 |    1 |        4
  10 |        6 |      -1 |   15 |    3 |    1 |        5
  11 |        7 |      -1 |   10 |    5 |  0.8 |        6
  12 |        8 |      -1 |   -1 |   -1 |    0 |      6.8
(12 rows)

Also the function can be used as described in #2317 for the creation of a points of interest table.

For the new function

  • sql code
  • pgtap tests
  • docqueries examples
  • documentation

For the withPoints function

  • at least one example usage on each function documentation page
  • Using on sample data the function to create the pointsOfInterest table

@pgRouting/admins

@cvvergara cvvergara added this to the Release 3.4.0 milestone Jun 18, 2022
@cvvergara cvvergara changed the title New function find close edges New function pgr_findCloseEdges Jun 18, 2022
@cvvergara cvvergara merged commit 4810f8b into pgRouting:develop Jun 20, 2022
@cvvergara cvvergara deleted the new_function-findCloseEdges branch June 20, 2022 00:21
@cvvergara cvvergara mentioned this pull request Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants