While I have plenty of ideas for Astronoby before I release v1.0, it is already mature enough for a lot of use cases.
One of them that I've been wanting to experiment with for a while is generating an SVG sky map for a specific date, time and location.
There are already plenty of websites with their own sky map, but as always what I like is understanding how it works, being able to do it myself, and more importantly offer an open source version for the community.
Step 1: Map and projection
Let's start simple, no Ruby, no dynamic data, just the map and a first star on it. Our SVG will sit in a 400px bordered square:
<svg viewBox = "0 0 400 400" width = "400" height = "400" style = "border: #ff0000 solid 1px" ></svg>
Enter fullscreen mode
Exit fullscreen mode
The viewBox attribute defines the SVG's own coordinate system, from 0 to 400 on both axes. It is independent of the size on screen, so the drawing scales if the SVG is resized instead of being cropped.
Then, the sky itself.…