Calculating position of sun, moon and planets

When coding Astro Mosaic tool I found very good information on calculation sun, moon and planet positions at a certain time and place. That information is used to calculate for example moon position and altitude during the night, sun rise and set times and moon phase.

Perhaps the best resource that I found was a page How to compute planetary positions written by Paul Schlyter. It has a lot of good and practical information. He has also another page Computing planetary positions - a tutorial with worked examples that has similar information. Those pages have all required information on orbital elements, coordinate transformations and such.