Fix incorrect polygon being produced for spatial searches

This was an unrecorded bug discovered by Seb. Parameters were being passed to the geometry
helper in an incorrect order resulting in a polygon that was not reflective of a bounding box.

Also fixed some failing tests.
Add some more files to .gitignore