[postgis-users] Convert spatial table to graph

Stephen Woodbridge woodbri at swoodbridge.com
Fri Feb 19 14:14:06 PST 2010


FRANK RADA wrote:
> Hi, if somebody can explain to me about the process of conversion from
> spatial table to graphs. im using a small table with lines that
> represents the streets of my city. i need run an ACO (ant colony
> optimization) algorithm to find the better route.
> 
> excuse my english, follow i write the paragraph in spanish for best
> undertanding.
> 
> Hola. si alguien puede explicarme acerca del proceso de convertir una
> tabla espacial a un grafo. uso una pequeña tabla con lineas que
> representan las calles de mi ciudad. necesito correr un algoritmo ACO
> para encontrar la mejor ruta.
> 
> 
> I apreciate your comments.

I think the first question is about your data.

Is it noded?
Do all intersections occur only at the ends of you segments?
Or do you have line segments the cross other segments without a node at 
the intersection?

If the data is not noded, then you need to node you segments, by 
chopping all crossing lines into multiple lines at any intersections.

When the data is noded, then you can look at pgRouting. The have a 
stored procedure that you can use that will make a graph by create a 
unique table of all nodes and updating you road segment table by adding 
the start and end node numbers.

You should nor be able to work with that to do your ant colony optimization.

-Steve W



More information about the postgis-users mailing list