I would like to enable pgr_drivingDistance function fo Pgrouting. I followed this manual: http://pgrouting.org/docs/1.x/install.html, but I can't execute the last step:

psql -U postgres -f /usr/share/postlbs/routing_dd.sql routing
psql -U postgres -f /usr/share/postlbs/routing_dd_wrappers.sql routing

These files don't exist in that addresses. And when I try to change the address from "/usr/share/postlbs/routing_dd.sql" to the path to routing_dd.sql in pgrouting, I get these errors:

psql:/home/user/pgrouting/src/driving_distance/sql/routing_dd.sql:27: ERROR:  permission denied for language c
psql:/home/user/pgrouting/src/driving_distance/sql/routing_dd.sql:37: ERROR:  permission denied for language c
psql:/home/user/pgrouting/src/driving_distance/sql/routing_dd.sql:80: ERROR:  must be owner of function pgr_pointsaspolygon

Until this step, everything goes well (and I really don't forget to compile Pgrouting with DrivingDistance functionality).

Does anyone have an idea what I'm doing wrong?

EDIT: Pgrouting with driving distance should be installed and enabled now, but when using drivingDistance function, I'm getting this error:

 File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 114, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
    cursor2.execute("SELECT id1::int4,cost::float8 from pgr_drivingDistance(%s, %s::int4, 10.0,false,false)", [query, source])
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 69, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
DatabaseError: error with no message from the libpq
[06/Apr/2014 09:05:46] "POST /map/findroute/ HTTP/1.1" 500 16972
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 129, in finish_response
  File "/usr/lib/python2.7/wsgiref/simple_server.py", line 36, in close
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 257, in close
  File "/usr/local/lib/python2.7/dist-packages/django/http/response.py", line 308, in close
  File "/usr/local/lib/python2.7/dist-packages/django/dispatch/dispatcher.py", line 185, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 94, in close_old_connections
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 462, in close_if_unusable_or_obsolete
    if self.is_usable():
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 192, in is_usable
    self.connection.cursor().execute("SELECT 1")
InterfaceError: connection already closed
[06/Apr/2014 09:05:46] "POST /map/findroute/ HTTP/1.1" 500 59
Exception happened during processing of request from ('', 53783)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 582, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 126, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.7/SocketServer.py", line 638, in __init__
  File "/usr/lib/python2.7/wsgiref/simple_server.py", line 124, in handle
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 89, in run
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 304, in handle_error
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 127, in finish_response
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 210, in write
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 267, in send_headers
    if not self.origin_server or self.client_is_modern():
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 280, in client_is_modern
    return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object has no attribute '__getitem__'

You are referring to the wrong documentation (the old version). The pgRouting 2.0 documentation is available here: http://docs.pgrouting.org/

It's important that pgRouting has been built with support for driving distance. This should be the case for binaries, but if you compile yourself, you need to enable it with the flag -DWITH_DD=ON.

If driving distance is available, then "CREATE EXTENSION pgrouting;" is all you need to do to install the functions in your database.

  • Thank you, so in this case it should work now, but it doesn't (I added to my question what error I'm getting). – user28800 Apr 6 '14 at 7:45
  • Please could you post your query without Django but only SQL? – dkastl Apr 7 '14 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.