Help with pgRouting & PostGIS

View: New views
5 Messages — Rating Filter:   Alert me  

Help with pgRouting & PostGIS

by Green-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have been using PostGIS for a while and it works great for my requirement. I have roads & streets as shapefile and now, I wanted to a find the shortest route between locations.

I found pgRouting during the search process. There they talk about topology. They have suggested to use 3 tools for creating data for pgRouting and I don't have access to 2 of them. The one that is familiar to me is PostGIS. I intalled the topology functions and I am struck without any direction. Now what ?

I request any one of you help me and I would greatly appreciate.

I have shapefiles of roads and how do I create data for pgRouting ?

Thanks
Green

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

RE: Help with pgRouting & PostGIS

by Pedro Doria Meunier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hey Green,

 

I have fiddled with this some time ago... (and I also was left scratching my head for a while :] )

 

Here’s what I’ve concocted:

 

Using OpenJump:

There a tool called ‘Planar Graph’ under tools->analysis

(uncheck create faces)

 

You’re give two layers à one with all the nodes (and their IDs) and the other with the edges.

The latter gives you the start and end nodes for each segment…

Since pgrouting works by setting turning costs for each node… You just have to add another field to this layer and set each node’s turning cost… ;-)

(you could, of course, transfer the attributes from the original layer (such as labels, names, etc…) to this layer…)

 

From this point on it’s a matter of deciding what you want to do under a programmatical point of view…

 

So you see you don’t have to go nuts with all that unfinished topology support… ;-)

 

HTH,

Pedro Doria Meunier

 

 

From: postgis-users-bounces@... [mailto:postgis-users-bounces@...] On Behalf Of Green
Sent: quarta-feira, 25 de Abril de 2007 11:15
To: postgis-users@...
Subject: [postgis-users] Help with pgRouting & PostGIS

 

Hi,

I have been using PostGIS for a while and it works great for my requirement. I have roads & streets as shapefile and now, I wanted to a find the shortest route between locations.

I found pgRouting during the search process. There they talk about topology. They have suggested to use 3 tools for creating data for pgRouting and I don't have access to 2 of them. The one that is familiar to me is PostGIS. I intalled the topology functions and I am struck without any direction. Now what ?

I request any one of you help me and I would greatly appreciate.

I have shapefiles of roads and how do I create data for pgRouting ?

Thanks
Green


_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Help with pgRouting & PostGIS

by Green-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hello Pedro,

Thank you very much for your mail. Yes, I have created two dataset (a) node (b) edge as you said. I was looking at the sample data given in PostLBS which has something like

CREATE TABLE "kanagawa" (gid serial PRIMARY KEY,
"length" numeric,
"x1" numeric,
"y1" numeric,
"x2" numeric,
"y2" numeric,
"source" int8,
"target" int8);
SELECT AddGeometryColumn('','kanagawa','the_geom','-1','MULTILINESTRING',2);
COPY "kanagawa" ("length","x1","y1","x2","y2","source","target",the_geom) FROM stdin;

In the edge data from OpenJump we have start and end nodes which will be source and target. Can you please point me out about how to get the rest of the columns. Which are the columns need to transfered from nodes layer and can I just use length(the_geom) to get the length column ?.

Thanks
Green.

On 25/04/07, Pedro Doria Meunier <pdoria@...> wrote:

Hey Green,

 

I have fiddled with this some time ago... (and I also was left scratching my head for a while :] )

 

Here's what I've concocted:

 

Using OpenJump:

There a tool called 'Planar Graph' under tools->analysis

(uncheck create faces)

 

You're give two layers à one with all the nodes (and their IDs) and the other with the edges.

The latter gives you the start and end nodes for each segment…

Since pgrouting works by setting turning costs for each node… You just have to add another field to this layer and set each node's turning cost… ;-)

(you could, of course, transfer the attributes from the original layer (such as labels, names, etc…) to this layer…)

 

From this point on it's a matter of deciding what you want to do under a programmatical point of view…

 

So you see you don't have to go nuts with all that unfinished topology support… ;-)

 

HTH,

Pedro Doria Meunier

 

 

From: postgis-users-bounces@... [mailto:postgis-users-bounces@...] On Behalf Of Green
Sent: quarta-feira, 25 de Abril de 2007 11:15
To: postgis-users@...
Subject: [postgis-users] Help with pgRouting & PostGIS

 

Hi,

I have been using PostGIS for a while and it works great for my requirement. I have roads & streets as shapefile and now, I wanted to a find the shortest route between locations.

I found pgRouting during the search process. There they talk about topology. They have suggested to use 3 tools for creating data for pgRouting and I don't have access to 2 of them. The one that is familiar to me is PostGIS. I intalled the topology functions and I am struck without any direction. Now what ?

I request any one of you help me and I would greatly appreciate.

I have shapefiles of roads and how do I create data for pgRouting ?

Thanks
Green


_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users



_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Help with pgRouting & PostGIS

by Nguyen Thi Van An :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Green,
You can use some functions for Postgis to do some of your need : startpoint to get x1, y1; endpoint to get x2, y2; length...; source and target are the topology column and they are generated by function assign_vertex_id
Hopes this helps,

Green-8 wrote:
Hello Pedro,

Thank you very much for your mail. Yes, I have created two dataset (a) node
(b) edge as you said. I was looking at the sample data given in PostLBS
which has something like

CREATE TABLE "kanagawa" (gid serial PRIMARY KEY,
"length" numeric,
"x1" numeric,
"y1" numeric,
"x2" numeric,
"y2" numeric,
"source" int8,
"target" int8);
SELECT AddGeometryColumn('','kanagawa','the_geom','-1','MULTILINESTRING',2);
COPY "kanagawa" ("length","x1","y1","x2","y2","source","target",the_geom)
FROM stdin;

In the edge data from OpenJump we have start and end nodes which will be
source and target. Can you please point me out about how to get the rest of
the columns. Which are the columns need to transfered from nodes layer and
can I just use length(the_geom) to get the length column ?.

Thanks
Green.

On 25/04/07, Pedro Doria Meunier <pdoria@netmadeira.com> wrote:
>
>  Hey Green,
>
>
>
> I have fiddled with this some time ago... (and I also was left scratching
> my head for a while :] )
>
>
>
> Here's what I've concocted:
>
>
>
> Using OpenJump:
>
> There a tool called 'Planar Graph' under tools->analysis
>
> (uncheck create faces)
>
>
>
> You're give two layers à one with all the nodes (and their IDs) and the
> other with the edges.
>
> The latter gives you the start and end nodes for each segment…
>
> Since pgrouting works by setting turning costs for each node… You just
> have to add another field to this layer and set each node's turning cost…
> ;-)
>
> (you could, of course, transfer the attributes from the original layer
> (such as labels, names, etc…) to this layer…)
>
>
>
> From this point on it's a matter of deciding what you want to do under a
> programmatical point of view…
>
>
>
> So you see you don't have to go nuts with all that unfinished topology
> support… ;-)
>
>
>
> HTH,
>
> Pedro Doria Meunier
>
>
>
>
>
> *From:* postgis-users-bounces@postgis.refractions.net [mailto:
> postgis-users-bounces@postgis.refractions.net] *On Behalf Of *Green
> *Sent:* quarta-feira, 25 de Abril de 2007 11:15
> *To:* postgis-users@postgis.refractions.net
> *Subject:* [postgis-users] Help with pgRouting & PostGIS
>
>
>
> Hi,
>
> I have been using PostGIS for a while and it works great for my
> requirement. I have roads & streets as shapefile and now, I wanted to a find
> the shortest route between locations.
>
> I found pgRouting during the search process. There they talk about
> topology. They have suggested to use 3 tools for creating data for pgRouting
> and I don't have access to 2 of them. The one that is familiar to me is
> PostGIS. I intalled the topology functions and I am struck without any
> direction. Now what ?
>
> I request any one of you help me and I would greatly appreciate.
>
> I have shapefiles of roads and how do I create data for pgRouting ?
>
> Thanks
> Green
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Help with pgRouting & PostGIS

by willt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi - I know you posted this months ago, but -

I created my topology using ArcInfo - exported my roads shapefile as a coverage, then typed 'build' + coverage name at the command prompt and you get the to and from nodes - all you need. export as shapefile, export to postgis then rename f_node to source and t_node to target - and off you go.

I was confused to begin with about the nodes - they are abstract in that there is no requirement for a separate nodes table - the source and target fields just show which edges connect to one another.

I had trouble with PostGis topology functions which is why I used ArcInfo.

Cheers

Will