Tower Defense Game

I am working on a tower defense game and my map is designed by using an array.

The array is laid out similar to this:

var mapArray:Array = new Array()
mapArray = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,2,1,1,1,2,0,0,0,0,0,0,0,
0,0,0,1,0,0,0,1,0,0,0,2,1,1,1,
1,1,1,2,0,0,0,1,0,0,0,1,0,0,0,
0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,
0,0,0,0,0,0,0,2,1,1,1,2,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

I loop through all the values in the array and 0’s are just empty tiles where towers can be placed, 1’s and 2’s are paths. The 2’s are also used to create waypoints for the enemies to follow, they are at the corners of the path.

My problem is, when I loop through the array and make points anywhere there is a 2, it puts them out of order from what the actual path would be. Does anyone have a better way of doing this programmatically and not having to manually type in the points for each map I use?