# [mapguide-users] Make a new operation: "calculate shortest path" (Dijkstra's algorithm)

Sergio Nistal Calvo serginistal at hotmail.com
Sun Mar 1 14:48:46 EST 2009

```I know I have to apply the Dijkstra algorithm (http://en.giswiki.net/wiki/Dijkstra's_algorithm), but what I don´t know is how to pass just a layer as map (the layer of roads) and not the whole map, how to pass the point of origin and point of destiny to calculate the shortest path, how to calculate the sum of length of shortest path, how to select the different sections of the shortest path ... in ultimately, I do not know how to implement this operation. It is possible that this operation someone has already done, so that, can someone pass me the code so I can adapt it to mine? Also, I saw this post and I don´t know if it already has answer http://n2.nabble.com/Dijkstra's-algorithm-td1818808.html, if the person who created the post was able to use these dll's http://pgrouting.postlbs.org. Thank you very much.

Date: Sun, 1 Mar 2009 09:56:54 -0500
Subject: Re: [mapguide-users] Make a new operation: "calculate minimum path"
From: rnorthcott at gmail.com
To: mapguide-users at lists.osgeo.org

Sounds like more of a Math problem. Which amazingly, computers can do math better than anything else.

Take a look here:

the resources in the back, and the theory is what you'll have to take from it to build your own shortest distance routes against your datasets.

But you're going to probably be doing a lot of looping, and array loading/sorting. Finding any intersections, then at the end, you'll be building different routes, and if any valid route grows longer than your current route, you end the loop, and go build a new route until you'r out of route choices.

That's my 2 cents into how I'd tackle it, but there is probably more sophisticated mathematical algorithms you need to look into.

-north

On Sat, Feb 28, 2009 at 3:29 PM, Sergio Nistal Calvo <serginistal at hotmail.com> wrote:

Hello,

I have a layer in a map that is about communication roads and I would like to make a operation which is to calculate the minimum path. I do not know how make it, any help is appreciated. I uses apache and php.

Thanks.

Tienes un nuevo Messenger por descubrir. ¡Descárgatelo!
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

_________________________________________________________________
Chatea sin límites en Messenger con la tarifa plana de Orange
http://serviciosmoviles.es.msn.com/messenger/orange.aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090301/6fd16251/attachment.html
```