SharpAstrology.SwissEph
0.2.2
dotnet add package SharpAstrology.SwissEph --version 0.2.2
NuGet\Install-Package SharpAstrology.SwissEph -Version 0.2.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpAstrology.SwissEph" Version="0.2.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SharpAstrology.SwissEph --version 0.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SharpAstrology.SwissEph, 0.2.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SharpAstrology.SwissEph as a Cake Addin #addin nuget:?package=SharpAstrology.SwissEph&version=0.2.2 // Install SharpAstrology.SwissEph as a Cake Tool #tool nuget:?package=SharpAstrology.SwissEph&version=0.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SharpAstrology.SwissEph - Ephemerides for SharpAstrology
About
This package provides an implementation of the IEphemerides interface from SharpAstrology.Base. It uses the SwissEphNet project, which provides bindings for the C-library swisseph.
SharpAstrology Packages
Package | Version | Description | Licence |
---|---|---|---|
SharpAstrology.Base | 0.10.0 | Base library | MIT |
SharpAstrology.SwissEph | 0.2.1 | Ephemerides package based on SwissEphNet | AGPL-3.0 |
SharpAstrology.HumanDesign | 1.1.0 | Extensions for the Human Design system | MIT |
SharpAstrology.HumanDesign.BlazorComponents | 0.2.1 | Human Design charts as Blazor components | MIT |
SharpAstrology.Vedic | 0.1.0 | Extensions for Vedic astrology systems | MIT |
SharpAstrology.West | 0.1.0 | Extensions for western astrology systems | MIT |
Install
dotnet add package SharpAstrology.SwissEph
Simple usage
using System.Text.Json;
using SharpAstrology.Enums;
using SharpAstrology.Ephemerides;
using SharpAstrology.Interfaces;
// Use Moshier, so you don't need the swiss eph files or JPL files
var ephemeridesService = new SwissEphemeridesService(ephType: EphType.Moshier);
IEphemerides eph = ephemeridesService.CreateContext();
// Calculate positional information for Sun, Moon and Venus on January 1st 2024
//
// Use UTC time or it will throw
var pointInTime = new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc);
var sunPosition = eph.PlanetsPosition(Planets.Sun, pointInTime);
Console.WriteLine(JsonSerializer.Serialize(sunPosition));
// {
// "Longitude":280.0390123591898,
// "Latitude":0.00016036961321834312,
// "Distance":0.9833183562567887,
// "SpeedLongitude":1.0189783966864485,
// "SpeedLatitude":-3.780307931918674E-05,
// "SpeedDistance":-1.1317598853344111E-05
// }
var moonPosition = eph.PlanetsPosition(Planets.Moon, pointInTime);
Console.WriteLine(JsonSerializer.Serialize(moonPosition));
// {
// "Longitude":155.9922487287969,
// "Latitude":3.567636008224304,
// "Distance":0.0027048134096186458,
// "SpeedLongitude":11.848401014998416,
// "SpeedLatitude":-0.7336498562140658,
// "SpeedDistance":4.901106714722023E-06
// }
var venusPosition = eph.PlanetsPosition(Planets.Venus, pointInTime);
Console.WriteLine(JsonSerializer.Serialize(venusPosition));
// {
// "Longitude":242.6123495376748,
// "Latitude":1.9498137075115765,
// "Distance":1.1819079026603012,
// "SpeedLongitude":1.2159947235695916,
// "SpeedLatitude":-0.029584567802327894,
// "SpeedDistance":0.006288212288100938
// }
// Calculate house cusp longitudes in the porphyrius system for location London
var houseCusps = eph.HouseCuspPositions(pointInTime, 51.509865, -0.118092, HouseSystems.Porphyrius);
Console.WriteLine(houseCusps.Cross[Cross.Asc]);
// 187,0750455769693
Console.WriteLine(houseCusps.Cross[Cross.Mc]);
// 99,22014310617769
Console.WriteLine(houseCusps.HouseCusps[Houses.House1]);
// 187,0750455769693
eph.Dispose();
// Calculate sidereal position for Mars with Lahiri ayanamsa
eph = ephemeridesService.CreateContext(Ayanamsas.Lahiri);
var marsPosition = eph.PlanetsPosition(Planets.Mars, pointInTime, EphCalculationMode.Sidereal);
Console.WriteLine(JsonSerializer.Serialize(marsPosition));
// {
// "Longitude":243.11756696456447,
// "Latitude":-0.5505143969483922,
// "Distance":2.423806669715993,
// "SpeedLongitude":0.7413840544065141,
// "SpeedLatitude":-0.00973948506357604,
// "SpeedDistance":-0.003035312479835423
// }
Use swiss eph files or JPL files for more precision
Follow the instruction from the original swisseph project and download the files you want. Than save to files into a folder and use the path to that folder in the SwissEphemeridesService constructor.
using SharpAstrology.Ephemerides;
using SharpAstrology.Interfaces;
SwissEphemeridesService ephemeridesService;
IEphemerides eph;
// for swiss eph files
ephemeridesService = new SwissEphemeridesService(rootPathToEph: "[PATH_TO_SWISSEPH_ROOT_FOLDER]", EphType.Swiss);
eph = ephemeridesService.CreateContext();
// for JPL files
ephemeridesService = new SwissEphemeridesService(rootPathToEph: "[PATH_TO_JPL_ROOT_FOLDER]", EphType.Jpl);
eph = ephemeridesService.CreateContext();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- SharpAstrology.Base (>= 0.10.0)
- SwissEphNet (>= 2.8.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.2.2 | 187 | 7/8/2024 |