[pgrouting-users] pgRouting and PHP Wrapper

Stephen Woodbridge woodbri at swoodbridge.com
Tue Feb 4 06:49:37 PST 2014


On 2/4/2014 4:10 AM, Muhammad Iqnaul Haq wrote:
> Hi Mr. Woodbridge
>
> It's been a while since our last discussion, as for my final research
> project in my University, I create my Routing web app using pgrouting. I
> followed the tutorial from foss4g (not the latest version, which I
> included in this email), I also learn from your website
> (http://gis.imaptools.com/routing/leaddog/?zoom=11&lat=33.86651&lon=35.51184&layers=B0TTTF&start=35.493583%2033.826664&stop=35.565174%2033.864285&method=STS&lang=eng).

Also note that this code uses a lot of custom code to do the driving 
directions and that is not part of pgrouting.

> I got some error issues, it's the PHP. I ran the firebug and got this
> error (included in email attachments) How can I solve this? Do you have
> suggestion?
> It's almost a week and I still can't figure it out, maybe it because my
> background is not computer science (I'm a geography student who really
> interested in Geospatial Technologies and in Indonesia the system like
> this is not popular yet).
>
> I'm using : PostgreSQL 9.3 64bit, postgis 2.1.1, pgrouting 2, geoserver
> 2.4.2. Windows 8.1 64bit.

You are trying to use code that was designed around postgis 1.x and 
pgRouting 1.x on postgis 2.x and pgRouting 2.

You have to change the function names and arguments to call the 
equivalent functions.

for example for postgis (these are a few of the changes needed).

distance() => st_distance()
setsrid() => st_setsrid()
length() => st_length()
astext() => st_astext()

For pgRouting in the switch statement you will have to read the 
documentation on  pgrouting 2 functions and rewrite the SQL statements.

I strongly recommend that you go through the 2.0 tutorial.

Also if you only plan to support one method like Dijkstra then you can 
forget about the switch statement and replace it with a single SQL 
statement for the method you want.

-Steve


More information about the Pgrouting-users mailing list