Hamtools.js - Javascript lib for several ham related stuff
For my project repeatermap.de I need several Javascript functions for several calculations. So I decided to write a small library or toolbox. Maybe it's useful for somebody else. There is not so much so far, but I will extend it whenever I need something else.
The library can be found at github: https://github.com/lnitram/hamtools.js
Here are some examples how it can be used
Calculate wavelength from frequency
Calculate wavelength in meter from frequency in MHz
var wavelength = Hamtools.f2l(freq);
Frequency: | MHz |
Wavelength: | m |
Calculate frequency from wavelength
Calculate frequency in MHz from wavelength in meters
var freq = Hamtools.f2l(wavelength);
Wavelength: | m |
Frequency: | MHz |
Parse position to lonLat
On aprs.fi the positions are shown in degrees and minutes. If you want to work with positions, just decimal would be much better. Here you can just paste a position from aprs.fi and you will get it in decimal degrees only. Also the maidenhead locator is calculated
var s = "53°35.86' N 9°56.87' E"; var pos = Hamtools.parsePosition(s); var lon = pos["lon"]; var lat = pos["lat"]; var loc = Hamtools.pos2loc(lon,lat,3);
Position | |
Parsed: | Lon: Lat: Loc: |
Calculate distance between 2 lon/lat
Ort | Lon | Lat |
---|---|---|
Location 1 | ||
Location 2 | ||
Distanz: | km |