Along the banks of the Nile today
The urban grid has a history stretching to the first civilizations. In ancient Egypt, along the flat featureless banks of the Nile, the orthogonal subdivision of the fields came naturally. The river ran north to south; east to west was the direction of the rising and setting sun. After the floods, which replenished the soils each year, the farmers would rebuild the bunds parallel and perpendicular to the river. As population grew, people started building on the farmlands, and the pattern would follow the pre-existing boundaries.
Urban pattern following the pre-existing agricultural pattern
In ancient civilization, the setting out of straight line using a rope would have been followed by the measurement of distance using a rope with knots. After that ancient surveyors would have discovered how to use a piece of string divided into 12 equal lengths to set out a right angle triangle, with the length of the sides in the proportion of 3:4:5.
With these basic techniques, the grid was quite simple to mark out. Indeed, ‘geometer’ means ‘land measurement’, and among its first applications was to subdivide land.
The worker's settelment at ancient town of Kahun, near Giza
Source: Raymnd Unwin,"Town Planning in Practice"
The world’s first “workers’ housing” may be at the ancient town of Kahun built about 3000BC for the builder’s of the pyramids at Illahun near Giza. The town was laid out on a rectilinear grid, and comprised a few large houses and many smaller ones, the latter containing four or five rooms each. On higher ground was a small acropolis serving as a community centre, place of worship and seat of government. The roads were built with a drain in the middle.
Funny enough, the layout grid happens to be on the north-south axis!
References: Raymond Unwin,"Town Planning in Practice", 1909
Spiro Kostof,"the City Shaped", 1991