WIP Feature/add geo information to the geotiff writer

Adding CRS writing functionality to the writer. Having some problems currently with opening the written file in MAC OS X image program. After it opens and is tested correctly, this is ready to be merged in.
It's just removing some code duplication, I use a map instead of a pattern matchning, saw the stuff when working with the writer, I can split if you want?