new WCS(header, images, optionsopt) → {WCS}
Create a new coordinate reference system that emulates the WCS (World Coordinate System) used in astronomy.
Parameters
-
header
object
JSON representation of the merged image header.
-
images
Array.<image>
Array of image extension metadata.
-
options
object
<optional>
Options.
Properties
-
nzoom
number
<optional>
9Number of zoom levels.
-
nzoom
Returns
-
WCS
Instance of a World Coordinate System.
Source
Members
code
Codename of the WCS coordinate reference system.
Default Value
- WCS
Source
Methods
_deltaLng(latLng, latLng0) → {number}
Compute the longitude of a point with respect to a reference point.
Parameters
-
latLng
leaflet.LatLng
World coordinates of the point.
-
latLng0
leaflet.LatLng
World coordinates of the reference point.
Returns
-
number
Difference in longitude (in degrees) in the interval -180 to 180 deg.
Source
distance(latlng1, latlng2) → {number}
Compute the distance between two points on the sphere.
Parameters
-
latlng1
leaflet.LatLng
World coordinates of the first point.
-
latlng2
leaflet.LatLng
World coordinates of the second point.
Returns
-
number
Spherical distance between the two points in degrees.
Source
fovToZoom(map, fov, latlng) → {number}
Compute the zoom level that corresponds to a given FoV at the provided coordinates.
Parameters
-
map
leaflet.Map
Leaflet map.
-
fov
number
Field of View in degrees.
-
latlng
leaflet.LatLng
World coordinates.
Returns
-
number
Zoom level.
Source
getProjection(header, optionsopt) → {string}
Extract the WCS projection code from a JSON-encoded image header.
Parameters
-
header
object
JSON representation of the image header.
-
options
object
<optional>
Projection options.
Returns
-
string
WCS projection code.
Source
hmsDMSToLatLng(Coordinate) → {leaflet.LatLng|undefined}
Convert an HMSDMS string to world coordinates.
Parameters
-
Coordinate
string
string in HMSDMS.
Returns
-
leaflet.LatLng
undefined
World coordinates, or
undefined
if the input string could not be translated.
Source
latLngToHMSDMS(latlng) → {string}
Convert world coordinates to an HMSDMS string (DMS code from the Leaflet-Coordinates plug-in).
Parameters
-
latlng
leaflet.LatLng
Input world coordinates.
Returns
-
string
Coordinate string in HMSDMS.
Source
multiLatLngToIndex(latlng) → {number}
Return index of chip closest to the given world coordinates in a multi-WCS setting.
Parameters
-
latlng
leaflet.LatLng
Input world coordinates.
Returns
-
number
Index of the closest chip (extension).
Source
multiLatLngToPoint(latlng, zoom) → {leaflet.Point}
Multi-WCS version of the projection to layer coordinates.
Parameters
-
latlng
leaflet.LatLng
Input world coordinates.
-
zoom
number
Zoom level.
Returns
-
leaflet.Point
Layer coordinates at the given zoom level.
Source
multiPntToIndex(pnt) → {number}
Return index of chip closest to the given pixel coordinates in a multi-WCS setting.
Parameters
-
pnt
leaflet.Point
Input (merged) pixel coordinates.
Returns
-
number
Index of the closest chip (extension).
Source
multiPointToLatLng(pnt, zoom) → {leaflet.LatLng}
Multi-WCS version of the de-projection from layer coordinates.
Parameters
-
pnt
leaflet.Point
Input layer coordinates at the given zoom level.
-
zoom
number
Zoom level.
Returns
-
leaflet.LatLng
De-projected world coordinates.
Source
multiProject(latlng) → {leaflet.Point}
Multi-WCS astrometric projection.
Parameters
-
latlng
leaflet.LatLng
Input world coordinates.
Returns
-
leaflet.Point
Projected (merged) pixel coordinates.
Source
multiUnproject(pnt) → {leaflet.LatLng}
Multi-WCS version of the astrometric de-projection.
Parameters
-
pnt
leaflet.Point
Input (merged) pixel coordinates.
Returns
-
leaflet.LatLng
De-projected world coordinates.
Source
parseCoords(str) → {leaflet.LatLng|undefined}
Parse a string of world coordinates.
Parameters
-
str
string
Input string.
Returns
-
leaflet.LatLng
undefined
World coordinates, or
undefined
if conversion failed.
Source
pixelScale(zoom, latlng) → {number}
Compute the layer pixel scale at the given world coordinates.
Parameters
-
zoom
number
Zoom level.
-
latlng
leaflet.LatLng
World coordinates.
Returns
-
number
Layer pixel scale (in degrees per pixel).
Source
rawPixelScale(latlng) → {number}
Compute the image pixel scale at the given world coordinates.
Parameters
-
latlng
leaflet.LatLng
World coordinates.
Returns
-
number
Pixel scale (in degrees per pixel).
Source
scale(zoom) → {number}
Convert zoom level to relative scale.
Parameters
-
zoom
number
Zoom level.
Returns
-
number
Relative scale.
Source
transform(pnt, zoom) → {leaflet.Point}
Convert pixel (image) coordinates to layer coordinates.
Parameters
-
pnt
leaflet.Point
Pixel coordinates.
-
zoom
number
Zoom level.
Returns
-
leaflet.Point
Layer coordinates at the given zoom level.
Source
untransform(layerpnt, zoom) → {leaflet.Point}
Convert layer coordinates to pixel (image) coordinates.
Parameters
-
layerpnt
leaflet.Point
Layer coordinates.
-
zoom
number
Zoom level.
Returns
-
leaflet.Point
Pixel (image) coordinates
Source
zoom(scale) → {number}
Convert relative scale to zoom level.
Parameters
-
scale
number
Relative scale.
Returns
-
number
Zoom level.
Source
zoomToFov(map, zoom, latlng) → {number}
Compute the FoV that corresponds to a given zoom level at the provided coordinates.
Parameters
-
map
leaflet.Map
Leaflet map.
-
zoom
number
Zoom level.
-
latlng
leaflet.LatLng
World coordinates.
Returns
-
number
Field of View in degrees.