Generation of 2D meshes with reduced number of elements while yielding accurate results is a major challenge in coastal numerical models. High-quality 2D unstructured meshes were generated using sizing functions, which were computed from Euclidean distances to coastal features at given spatial locations and assigned element sizes based on calculated distances. The coastal features consist of National Water Model (NWM) streamlines, National Hydrography Dataset (NHD), NOAA Medium Resolution Shoreline and bathymetric features from the United States Army Corps of Engineers (USACE). This approach allows improved integration of the hydrodynamic D-Flow Flexible Mesh (D-Flow FM) model into the hydrological NWM and results in an optimum number of computational points. The method grants the user flexibility to control element sizes and avoids manual iterative procedures by determining an optimal element-sizing function that defines small element scales in regions where geometrical and physical characteristics exist, with larger scales elsewhere. Newly created continental-scale meshes on the Atlantic Ocean, Gulf of Mexico and Pacific Ocean coastlines demonstrate the application of the proposed method for automatic generation of unstructured, high-quality 2D meshes.