Add bounding polygon function for use in determining spatial extent

Yeah, this code is pretty much what I pulled off the internet, but I guess we can clean it up as long as the reference is kept