Refactor and fix PostGIS signatures