Its not the only way, theres like dozens.
You need to say what you want to do, not postulate how you think you should go about it.
We have no idea why you need to pick the object, so we can't give you a better way to go about it.
Associating a object by its position is a bad way to go unless you are dealing in absolute positions. As in not using sub-pixel coordinates, or decimals.
You have to say something like "how do I pick this object when its close to this other object?", or something like that.