Measure the total width at the intended shelf location. If your measurement comes to a fraction ending in 1/16" or 1/32", round down to the nearest 1/8".
Measure depth from the front of the furthest obstruction (lock, crank, handle, or trim) out to the desired projection, and round down to the nearest 1/8". This ensures the shelf clears hardware and fits flush.