简体   繁体   English

rows_where参数未传递给pgr_nodenetwork

[英]rows_where argument not passed to pgr_nodenetwork

I am using the pgr_NodeNetwork function of the pgrouting extension to process a table that contains linestring geometries (essentially, roads). 我正在使用pgrouting扩展的pgr_NodeNetwork函数来处理包含线串几何(主要是道路)的表。

The syntax is the following : 语法如下:

select pgr_nodeNetwork(edge_table:='my_table', 
tolerance:=0.0001,
id:='id', 
the_geom:='the_geom',
table_ending:='noded',
rows_where:='id < 10',
outall:=false);

In particular, the argument rows_where is used to process only the rows for which the condition rows_where is true. 特别是,参数rows_where用于仅处理条件rows_where为true的行。

However, at the beginning of the execution, the following notice is raised: 但是,在执行开始时,会引发以下通知:

NOTICE:     pgr_nodeNetwork('my_table', 0.0001, 'id', 'the_geom', 'noded', '<NULL>',  f)

You can see that the notice doesn't take account of the rows_where argument that was passed to the function (in my example, it was 'id < 10' ). 您可以看到通知没有考虑传递给函数的rows_where参数 (在我的示例中,它是'id < 10' )。

Moreover, it doesn't seem to be only a display problem in the notice itself, because the processing takes hours for a table with millions of rows, while it should be very fast if the condition 'id < 10' had really been taken account of (because it would be a table with less than 10 rows). 此外,它似乎并不仅仅是通知本身的显示问题,因为对于具有数百万行的表,处理需要数小时,而如果条件'id < 10'确实已被考虑在内,则应该非常快(因为它将是一个少于10行的表)。

On the other hand, if we explore the code of the function itself, it begins with: 另一方面,如果我们探索函数本身的代码,它开始于:

    CREATE OR REPLACE FUNCTION sig.pgr_nodenetwork(
        edge_table text,
        tolerance double precision,
        id text DEFAULT 'id'::text,
        the_geom text DEFAULT 'the_geom'::text,
        table_ending text DEFAULT 'noded'::text,
        rows_where text DEFAULT ''::text,
        outall boolean DEFAULT false)

....

raise notice 'pgr_nodeNetwork(''%'', %, ''%'', ''%'', ''%'', ''%'',  %)',
    edge_table, tolerance, id,  the_geom, table_ending, rows_where, outall;

If you define another function with the same parameters and the same RAISE NOTICE instruction at the beginning, you will see that the notice raised by the function correctly reproduces the rows_where argument passed by the user. 如果您在开头使用相同的参数和相同的RAISE NOTICE指令定义另一个函数,您将看到函数引发的通知正确地再现了用户传递的rows_where参数。

Does anybody has an explanation as to why the rows_where argument seems to be utterly ignored by the pgr_nodeNetwork function, while defining a brand new function with the exact same code doesn't yield the same result? 有没有人解释为什么rows_where参数似乎被pgr_nodeNetwork函数完全忽略,而用完全相同的代码定义一个全新的函数不会产生相同的结果?

It seems to be a bug ( https://github.com/pgRouting/pgrouting/issues/1074 ). 这似乎是一个错误( https://github.com/pgRouting/pgrouting/issues/1074 )。 Although not fixed in the extension itself, I provided an alternative (custom) function (see link above). 虽然没有在扩展本身中修复,但我提供了另一种(自定义)功能(参见上面的链接)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM