Calibrating hydraulic models for water distribution systems (WDS) is crucial during model-building, particularly in determining the roughness coefficients of pipes. However, using a single roughness coefficient based solely on pipe material can lead to significant variations in frictional head losses. To address this issue and enhance computational efficiency, this study utilized genetic algorithm (GA) for optimizing roughness coefficients with the Environmental Protection Agency Network Evaluation Tool (EPANET) hydraulic model. EPANET-GA further considers the spatial characteristics of pipes. The study incorporated an automated calibration process and a user graphic interface to analyze the water head pressures of WDS nodes for the Zhonghe and Yonghe districts. The model was optimized with 34,783 node items, 30,940 pipes, and 140 field measurements. Results reveal that the optimized roughness coefficient produces a high correlation coefficient (0.90) with the measured data in a time slot. Besides, a low standard error (8.93%) was achieved for 24-hour predictions. Furthermore, in the Shelin–Beitou district, the consideration of spatial characteristics was incorporated as constraints during the calibration process. The improved outcomes indicate that the EPANET-GA is a reliable reference for WDS design and routing scenarios in practice.