to polygon function for polyline