removed unnecessary coord sys vars and made better use of one

- we no longer need to transform from one coord sys to another, so these other vars aren't needed
- instead of hard coding the reference system ID in the sql we can make use of a variable (safe since not from a user)
whitespace/newline changes for readability