Based on your screenshot it seems that the length of all parallel lines are equal but the width spacing between them is not uniform. In such a case, to find a centerline programatically, you can
- Resample your polylines at regular interval for eg. 1 point / meter to
obtain uniform sampling rate across all polylines
- Next find midpoints of line segments connecting every N-th point pair of adjacent polylines
- Create a line connecting all midpoints obtained in step 2 for each adjacent pair of lines to obtain centerline between each adjacent pair of lines
Another option is to create a raster of a polygon created by every adjacent set of line and then use something a skeletonization algorithm to find a centerline and convert that raster skeleton back to vector representation.
Edit:
You can also skeletonize the polygons created by adjacent lines directly, without converting them to rasters using Polygonal Skeletons