[pgrouting-users] Regarding pgrouting and postgis for shortest path

Stephen Woodbridge woodbri at swoodbridge.com
Thu Jan 16 14:11:23 PST 2014


On 1/16/2014 4:54 PM, Raghavan Krishnasamylakshmanaperumal wrote:
> Steve,
> Thanks for pointing out various resources, probably I didn't explain
> about my data properly. So the data which I have is not just two points,
> I have collected data from my and some of my friend's runkeeper
> <http://runkeeper.com/> GPS traces for various activities like running,
> walking, biking in and around Chicago. I have all these GPS
> points(longitude,latitude) information with me. What I am trying to find
> is the shortest path given any two points from the data which I have
> collected.

Then you should be able to:
1. load the track points into a table
2. convert the tracks into linestrings
3. then run pgr_nodenetwork
4. update the resulting table to include costs or lengths
5. then run pgr_createTopology
6. then map a start point and end point to the network nodes
7. call pgr_dijkstra to get shortest path

All of the above happens in the database

8. write a client application the connects to the database maps the 
start and end points, computes the path and displays it or whatever you 
need to do with it.

-Steve

> Thanks,
> Raghavan
>
>
> On Thu, Jan 16, 2014 at 3:42 PM, Stephen Woodbridge
> <woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>> wrote:
>
>     On 1/16/2014 4:31 PM, Raghavan Krishnasamylakshmanaperumal wrote:
>
>         Steve,
>         Thanks for your reply, I think I almost understood. So you say that
>         having only these GPS point may not help me I should also have the
>         network map corresponding to these GPS points using which I can
>         figure
>         out the shortest path?
>
>
>     if you only have two point on the earth and nothing more what is the
>     shortest path. "Path" implies that you have a network of paths and
>     that you want to find the the shortest path within the network. If
>     you only have the points and no network then you can not find the
>     shorth path in the network, because you do not have one.
>
>     The way things works is that we take a point and find the nearest
>     edge ot node in our network for that point and that then becomes the
>     start or end point in the network. Dijkstra then searchs the network
>     for the shortest path between two points.
>
>
>         So right now I have only these GPS points, how should I proceed
>         further
>         to figure out the shortest path between any two GPS points from
>         my data.
>
>
>     You can't do anything with just these points. You have to make them
>     to a network and then search for a solution within that network.
>
>     So you have to find network data that you can use for your area of
>     interest. You might look at OSM data and osm2pgrouting to load it
>     into pgRouting.
>
>     You could also look into using Project-OSRM (requires 64bit HW)
>     which is the router used by OSM.
>
>
>         I am open to use any database/framework/language so please
>         suggest me
>         how to proceed further and I am concerned about  scalability or
>         other
>         factors because this is just a proof of concept(course project)
>         which I
>         am trying to build.
>
>
>     pgRouting
>     Project-OSRM
>     google: java dijkstra
>
>     There are lots of choices, but all require that you have network data.
>
>     -Steve
>
>         Thanks,
>         Raghavan
>
>
>         On Thu, Jan 16, 2014 at 12:21 PM, Stephen Woodbridge
>         <woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>
>         <mailto:woodbri at swoodbridge.__com
>         <mailto:woodbri at swoodbridge.com>>> wrote:
>
>              On 1/16/2014 12:46 PM, Raghavan Krishnasamylakshmanaperumal
>         wrote:
>
>                  Recently I started using PostGIS for my academic
>         project which is a
>                  route recommendation system. I have stored the data in the
>                  following format.
>                  /
>                  /
>                  /gid=>integer, activity=>varchar(20), geom
>         geometry(Point,4326)/
>
>
>                  geometry points are longitude and latitude information, for
>                  example if
>                  you record your Running activity using a gps device,
>         each point
>                  record
>                  (longitude & latitude) is stored in the geom column.
>
>
>              The shortest distance between two points is a straight line
>         unless
>              you want to constrain the problem to the shortest distance
>         along
>              some road or path network.
>
>              If it is constrained to a networks of paths then you have
>         to have
>              the data for that network available.
>
>              In the case of pgRouting, you have to load the network data and
>              prepare it for routing, then you can use you points as the
>         start and
>              end points of a route and ask pgRouting to fins the
>         shortest path
>              between them along the network.
>
>
>                  I need to find the shortest path(using Dijkistra's)
>         between any
>                  two geom
>                  points from this data set and I am trying to automate
>         this using
>                  some
>                  programming language like Java.
>
>
>              With Java you can connect to the database and issue simple
>         queries
>              to pgRouting to get your results. If you are looking for a Java
>              library to solve Dijkstra problems then this is not
>         pgRouting. Also
>              if you are using a Java library you will still need to load the
>              network of paths that you want to solve you queries against.
>
>              Hope this helps,
>                 -Steve
>
>                  Please can you suggest me how to make use of pgrouting and
>                  postgis data
>                  to figure out the shortest path. Is there any library
>         available to
>                  automate this using Java. I am totally stuck on my
>         project and
>                  finally
>                  came to know about this mailing list.
>
>
>                  --
>                  Thanks and Regards,
>                  Raghavan KL
>
>
>                  ___________________________________________________
>                  Pgrouting-users mailing list
>                  Pgrouting-users at lists.osgeo.____org
>                  <mailto:Pgrouting-users at lists.__osgeo.org
>         <mailto:Pgrouting-users at lists.osgeo.org>>
>         http://lists.osgeo.org/____mailman/listinfo/pgrouting-____users
>         <http://lists.osgeo.org/__mailman/listinfo/pgrouting-__users>
>
>         <http://lists.osgeo.org/__mailman/listinfo/pgrouting-__users
>         <http://lists.osgeo.org/mailman/listinfo/pgrouting-users>>
>
>
>              ___________________________________________________
>              Pgrouting-users mailing list
>              Pgrouting-users at lists.osgeo.____org
>              <mailto:Pgrouting-users at lists.__osgeo.org
>         <mailto:Pgrouting-users at lists.osgeo.org>>
>         http://lists.osgeo.org/____mailman/listinfo/pgrouting-____users
>         <http://lists.osgeo.org/__mailman/listinfo/pgrouting-__users>
>
>
>         <http://lists.osgeo.org/__mailman/listinfo/pgrouting-__users
>         <http://lists.osgeo.org/mailman/listinfo/pgrouting-users>>
>
>
>
>
>         --
>         Thanks and Regards,
>         Raghavan KL
>
>
>         _________________________________________________
>         Pgrouting-users mailing list
>         Pgrouting-users at lists.osgeo.__org
>         <mailto:Pgrouting-users at lists.osgeo.org>
>         http://lists.osgeo.org/__mailman/listinfo/pgrouting-__users
>         <http://lists.osgeo.org/mailman/listinfo/pgrouting-users>
>
>
>     _________________________________________________
>     Pgrouting-users mailing list
>     Pgrouting-users at lists.osgeo.__org
>     <mailto:Pgrouting-users at lists.osgeo.org>
>     http://lists.osgeo.org/__mailman/listinfo/pgrouting-__users
>     <http://lists.osgeo.org/mailman/listinfo/pgrouting-users>
>
>
>
>
> --
> Thanks and Regards,
> Raghavan KL
>
>
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
>



More information about the Pgrouting-users mailing list