Array, how to draw a line dynamically... and a map

Hi there.
I am doing a small map of my city -a very small city-. And thinking to do the common feature where the user clicks a starting point and an ending point and route will be displayed on the map.

So far, i know that i need to create a 2D array.

But here are some questions that i have:
How would i draw, dinamically, the lines (the route, or path to be taken)?
And how to handle (in case i really need a 2D array) a huge array? (since it always shows me a window msg telling that this script is taking long… bla bla bla)…
Thanks.
Cheers.
Leo.