Now that I have an interactive sky map, it's time to update the older of my pages to that instead of the static images they contained. First, the Milky Way halo page, with an overview of all the objects orbiting around our home galaxy, like globular clusters, satellite galaxies and tidal streams. It's also an occasion to extend the sky map D3-Celestial to include additional data, in this case all those aforementioned objects, and see how easy that would be.
[Click on the image for an interactive and embiggenable version]
The function to add data looks like this:
Celestial.add({file:<path>, type:[dso|line|star], callback:<function>[, redraw:<function>]});
with the object-literal containing the parameters file
- the path to the GeoJSON file containing the data to display, type
- the kind of data being added (only dso and line implemented so far) and callback
- the function that is called from the D3 json-loading function, which adds the contained objects to the global svg path, in D3-Celestial exported as Celestial.svg
. That is all you need if you only want a static display without interaction. See the D3.js documentaion about the details. The last (optional) parameter redraw
is called when the display is updated after an interaction and contains a subset of the data-adding instrunctions that is needed to determine the new view state.
No comments:
Post a Comment