make polyline layer a bit DRYer, inspired by @codefox421