31 crosses NY 270 and NY 93. Continuing into the city, NY 31 meets NY 78 (Transit Road) at an intersection partially located over the Erie Canal. NY 31 heads eastward through Lockport, intersecting the northern terminus of NY 77 at the eastern edge of the city. While NY 77 continues along the right-of-way of NY 31, NY 31 exits, following a northeasterly alignment through Gasport to Middleport, where it acts as the western and southern terminus of NY 31E and NY 271, respectively. Just east of town, NY 31 crosses the first of nine county lines along its routing, entering Orleans County. At an intersection south of Medina, NY 31A branches off, continuing straight from NY 31 while NY 31 turns north to overlap NY 63 for a short distance between NY 31A and NY 31E in Medina. At NY 31E, NY 31 separates from NY 63, following the path of NY 31E east out of the village. to the east, NY 31 crosses NY 98 in Albion. Midway between Albion and Holley, NY 31 intersects the southern end of NY 387. NY 31 continues to the southeast, entering Holley and intersecting NY 237 in the village center. The route quickly leaves Holley soon after, crossing into Monroe County just over a mile (about 1.6 km) from the village line. Rochester area Western suburbs and downtown Just inside the Monroe County line, the road traverses the Erie Canal before intersecting Redman Road about west of the village of Brockport. NY 31 turns south here, following Redman Road back across the Erie Canal and past the western fringe of the SUNY Brockport campus to a junction with Fourth Section Road. NY 31A enters the intersection from the west and ends at NY 31 while the latter turns east onto Fourth Section Road. NY 31 progresses eastward, intersecting NY 19 in a commercialized area directly south of Brockport and becoming Brockport–Spencerport Road. East of the village in the surrounding town of Sweden, NY 31 meets the southern terminus of NY 260. The route continues eastward, paralleling the Erie Canal as it enters Ogden, where NY 31 comes to the current western terminus of NY 531, the Spencerport Expressway, and, shortly after, the northern terminus of NY 36. NY 31, now sandwiched by the canal to the north and NY 531 to the south, heads eastward into the village of Spencerport, where