Seems like a great deal of what you've written here is duplicated by https://github.com/Maps4HTML, and that it would be worth reaching out to that community.