Measure from the top of your deck to your boat's water-line (while lightly loaded). If you're not sure where the water line is, take along a strip of edging tape next time you've got your boat out. Stick the tape to your boat just above the water line before you trailer your boat. The edging tape will peel off easily and won't leave adhesive behind after you take measurements.
After you've got a measurement from the top of the deck to the waterline, add 20 inches to your measurement to come up with your minimum shaft length. If you plan on fishing rougher waters, add another six inches to the shaft length to compensate for bow lift. For example, if your deck is 15" above the water line, you'll want a 35" shaft (minimum), and a 41" shaft for rougher waters. Since most manufacturers don't offer a 35" or 41" shaft length, you'll round up to the 42" shaft.