pgrouting
pgrouting copied to clipboard
pgr_findClosestEdge
I wrote a variation on this command for a client that I believe is giving the correct results. I loaded the pgr_findClosestEdge function from the
Expected behavior and actual behavior
Expected Behavior:
$ psql -U postgres -h localhost -p 5434 mydatabase -c "select * from imt_findClosestEdge('ways', st_setsrid(st_makepoint(-71.38835, 42.61954), 4326), 100);"
edge_id | fract | side
---------+-------------------+------
4990 | 0.674130406266285 | R
(1 row)
Actual behavior:
$ psql -U postgres -h localhost -p 5434 mydatabase -c "select * from pgr_findClosestEdge('select gid as id, * from ways', st_setsrid(st_makepoint(-71.38835, 42.61954), 4326), 100/111120.0);"
edge_id | fraction | side
---------+----------+------
4990 | 1 | l
(1 row)
Steps to reproduce the problem
Specifications like the version of pgRouting/PostGIS and PostgreSQL as well as Operating System
Use the commands:
SELECT version();
-- PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit
SELECT postgis_full_version();
-- POSTGIS="2.2.2 r14797" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" LIBJSON="0.11.99" RASTER
SELECT pgr_version();
-- (2.2.0,b02f95f,new-travis-dev,1.54.0)
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty
I don't see a pgr_findClosestEdge function. I see a .pgr_pointToEdgeNode.
Why don't you use what is in master branch, that one has v2.2.0
develop now has v2.3.0-dev.
Do a
\dx+ pgrouting
to verify that that function exists, because I dont see it in any of the signatures
tools/sigs/ $ cat * | grep find
Sorry, I have too many everything loaded on my system with pg9.2, pg9.3, pg9.4 and many versions of pgrouting in various databases and over a 100 databases spread over these system. Not to mention compiling various dev versions for testing and debugging.
Anyway, I thought that was one of the standard commands you added for use with viaNodes() functions. Its hard to keep track of everything, if this is not an official/proposed function then feel free to ignore this.
I like the name & functionality better than your proposed function: pgr_pointToEdgeNode
I must say that I found the code I wrote named pgr_findClosestEdge. Its being part of pgRouting since December 2015, properly licensed with a GNU license. https://github.com/pgRouting/pgrouting/blob/master/src/common/sql/findClosestEdge.sql
The reason it was not included on the release is that still has some issues about the left & right side of a segment detection. But for developing & do some basic testing to the pgr_withPoints family of functions it is ok.
If I have time I will try to fix the issues it has.
Note: from the code: https://github.com/pgRouting/pgrouting/blob/master/src/common/sql/findClosestEdge.sql#L92 my output is
l
which looks a lot as a 1,
so, I will make the arrangements to pgr_withPoints family of functions to accept upper and lower case for right and left characters:
right: R or r
left: L or l