Compress location lookup using gzip.

This commit introduces optional compression of the location lookups. Some code cleanup for elements shared between lookup and uploading.

Closes #446.

Todo: move most of the communication code into NetworkUtils.
Merge pull request #459 from tamcap/gzip_location

Compress location lookup using gzip (@tamcap)