Open magnets, no doubt.
If you “close the circuit”, you all but eliminate any stray magnetism. (That’s why toroidal inductors/transformers have almost zero stray field.)
So instead of, say, just taking a small Nd “pill” magnet and tacking it onto one end, you can take a thin magnetised rod, and put it in parallel with the magswitch so that the field “shorts” through the magswitch itself.
So unless you’re resting surveying equipment right on top of the magnet+switch, it should have no effect.
You initially said “electronic or mechanical”, so…
Anyway, by just snipping one lead to put the magswitch inline, then sealing the exposed leads, and having, say, heatshrink tubing on top of the whole mess (eg, also sealed with hotglue), you can make it impervious to water.