[postgis-users] Help with pgRouting & PostGIS

Green vgsk04 at gmail.com
Wed Apr 25 09:45:55 PDT 2007


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 at 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 at postgis.refractions.net [mailto:
> postgis-users-bounces at postgis.refractions.net] *On Behalf Of *Green
> *Sent:* quarta-feira, 25 de Abril de 2007 11:15
> *To:* postgis-users at 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 at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070425/370dacab/attachment.html>


More information about the postgis-users mailing list