サポート (#26) - A*による経路探索でPostgreSQLがダウンします。 (#197) - Message List

A*による経路探索でPostgreSQLがダウンします。

はじめまして。

インストールが完了し、道路データもデータベースに登録済みです。

そこで、pgroutingのA*アルゴリズムを使用するとPostgreSQLがダウンします。 同様にダイクストラのアルゴリズムでも発生してしまいます。

shooting*アルゴリズムでは問題なく経路検索でき、結果も正常に表示されます。

どのアルゴリズムでもsourceノードとtargetノードは同一地点で行っています。

原因を探ろうと、ログファイルなど調べましたがわかりませんでした。

コマンドでSQL文を発行すると、以下のようなメッセージがでます。

routing=> select * FROM shortest_path_astar('SELECT gid as id, id1 as source, id2 as target, linklength::float8 as cost, x(StartPoint?(the_geom)) as x1, y(StartPoint?(the_geom)) as y1, x(EndPoint?(the_geom)) as x2, y(EndPoint?(the_geom)) as y2 FROM road_link', 600311666, 603193351,false,false);

改善方法が分かる方がいらっしゃいましたら教えてください。

よろしくお願いいたします。

////////////////////////////////////////

***サーバー環境***

・CentOS 5.1 ・pgRouting-1.03 ・boost_1_36_0 ・cmake-2.6.2 ・geos-3.0.0 ・proj-4.6.0 ・PostgreSQL 8.3.1

CPU : Intel(R) Core(TM) Duo CPU T2500 @ 2.00GHz

メモリ :

total used free shared buffers cached

Mem: 2074604 332576 1742028 0 18852 263236 -/+ buffers/cache: 50488 2024116 Swap: 2031608 0 2031608

////////////////////////////////////////

*** /usr/local/pgsql/data/serverlogの内容 ***

terminate called after throwing an instance of 'std::length_error'

what(): vector::_M_fill_insert

LOG: server process (PID 3127) was terminated by signal 6: Aborted

LOG: terminating any other active server processes

LOG: all server processes terminated; reinitializing

LOG: database system was interrupted; last known up at 2008-12-26 00:36:02 JST

LOG: database system was not properly shut down; automatic recovery in progress

LOG: record with zero length at 2/4DEE74A4

LOG: redo is not required

LOG: autovacuum launcher started

LOG: database system is ready to accept connections

  • Message #742

    こんにちは。

    ※日本語でタイトルを入力すると、reply時にエラーが出るようです。administratorにお願いしてタイトルを英文に変えてもらいました。ご了承ください。

    解決への的を射ていないかもしれませんが、

    ・ほかのノード(source,target)を使っても、やっぱり失敗しますでしょうか。

    ・costに使っている値(degree?, meter?)

    ・座標系(SRID)

    などの情報はありますでしょうか。

    また、pgRoutingには、別途バウンディングボックスを指定してその範囲内で経路探索をする

    astar_sp_delta()

    というものもありますが、その結果はどのようになるでしょうか。

    使い方は、チュートリアルにも書いてありますが、

    http://pgrouting.postlbs.org/wiki/WorkshopFOSS4G2008/ch08

    SELECT gid, AsText?(the_geom) AS the_geom

    FROM astar_sp_delta('ways', 10, 20, 0.1);

    というような感じです。

    • Message #753

      返信ありがとうございます。 日本語でのタイトルの件は改善されてますね。感謝します。

      ・ほかのノード(source,target)を使っても、やっぱり失敗しますでしょうか。

      特定のノードで成功するようです。 ノード数をWHERE文を用いて制限することで成功するようになりました。

      ・costに使っている値(degree?, meter?)

      meterです。

      ・座標系(SRID)

      SRIDは”4612”のJGD2000を使ってます。

      pgRoutingには、別途バウンディングボックスを指定してその範囲内で経路探索をする astar_sp_delta() というものもありますが、その結果はどのようになるでしょうか。

      astar_sp_delta()の使い方が分からなかったので、とんでもないSQLを発行しているかもしれませんが、実行結果は以下のようになります。

      ////////////////////////////////////////////////////////////////////////

      SELECT gid, AsText?(the_geom) AS the_geom FROM astar_sp_delta('_astar', 135, 136, 0.1);

      ERROR: cannot EXECUTE a null querystring

      CONTEXT: PL/pgSQL function "astar_sp_delta_directed" line 75 at FOR over EXECUTE statement

      PL/pgSQL function "astar_sp_delta" line 19 at FOR over EXECUTE statement

      /////////////////////////////////////////////////////////////////////////

      よろしくお願いします。

      • Message #754

        こんにちは。

        すみません、1箇所だけですが・・・。

        astar_sp_delta()の使い方が分からなかったので、とんでもないSQLを発行しているかもしれませんが、実行結果は以下のようになります。 //////////////////////////////////////////////////////////////////////// SELECT gid, AsText?(the_geom) AS the_geom FROM astar_sp_delta('_astar', 135, 136, 0.1); ERROR: cannot EXECUTE a null querystring CONTEXT: PL/pgSQL function "astar_sp_delta_directed" line 75 at FOR over EXECUTE statement PL/pgSQL function "astar_sp_delta" line 19 at FOR over EXECUTE statement /////////////////////////////////////////////////////////////////////////

        SELECT gid, AsText?(the_geom) AS the_geom FROM astar_sp_delta('_astar', 135, 136, 0.1);

        としたときに、'_astar'はテーブル名、135と136はそれぞれソースとターゲットのID、0.1はバウンディングボックスのバッファ(ID=135とID=136で作られる矩形より、縦横0.1度分を広く取った矩形)ということになります。

        取り急ぎにて。

        • Message #755

          早速の返信、ありがとうございます。 astar_sp_delta()の引数を修正しましたところ、クエリが成功しました。

          実行したSQLは

          SELECT id, AsText?(the_geom) FROM astar_sp_delta('_astar', 600311666,603193351,0.8954);

          です。

          結果として、(935 rows)のWKT文字列が得られました。

          バウンディングボックスの値を変更し、

          SELECT id, AsText?(the_geom) FROM astar_sp_delta('_astar', 600311666,603193351,0.8955);

          とすると、以下のエラーが発生します。

          /////////////////////////////////////////////////////////////////////////

          routing=> SELECT id, AsText?(the_geom) FROM astar_sp_delta('_astar',600311666,603193351,0.8955);

          server closed the connection unexpectedly

          This probably means the server terminated abnormally

          before or while processing the request.

          The connection to the server was lost. Attempting reset: Failed.

          /////////////////////////////////////////////////////////////////////////

          ログのほうには以下のように出力されました。

          /////////////////////////////////////////////////////////////////////////

          terminate called after throwing an instance of 'std::bad_alloc'

          what(): St9bad_alloc

          LOG: server process (PID 32648) was terminated by signal 6: Aborted

          LOG: terminating any other active server processes

          FATAL: the database system is in recovery mode

          LOG: all server processes terminated; reinitializing

          LOG: database system was interrupted; last known up at 2009-01-14 03:27:16 JST

          LOG: database system was not properly shut down; automatic recovery in progress

          LOG: record with zero length at 2/BC6FBCB8

          LOG: redo is not required

          LOG: autovacuum launcher started

          LOG: database system is ready to accept connections

          /////////////////////////////////////////////////////////////////////////

          よろしくお願いします。

          • Message #756

            こんにちは。

            うーん・・・、難しいですね。。。

            使っている元のデータは何かのネットワークデータから取り込まれたものでしょうか。

            それとも自作でしょうか。

            データを取り込んだ場合、どのようにして取り込まれたでしょうか。

            また、deltaファンクションで得られたWKTの列は、何かのアプリなど使って

            実際に表示してみましたでしょうか。

            その列は問題なさそうでしょうか?(線に破綻がないとか)