new WCS(header, images, optionsopt) → {WCS}
Create a new coordinate reference system that emulates the WCS (World Coordinate System) used in astronomy.
Parameters
-
header
objectJSON 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
-
WCSInstance 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.LatLngWorld coordinates of the point.
-
latLng0
leaflet.LatLngWorld coordinates of the reference point.
Returns
-
numberDifference 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.LatLngWorld coordinates of the first point.
-
latlng2
leaflet.LatLngWorld coordinates of the second point.
Returns
-
numberSpherical 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.MapLeaflet map.
-
fov
numberField of View in degrees.
-
latlng
leaflet.LatLngWorld coordinates.
Returns
-
numberZoom level.
Source
getProjection(header, optionsopt) → {string}
Extract the WCS projection code from a JSON-encoded image header.
Parameters
-
header
objectJSON representation of the image header.
-
options
object<optional>
Projection options.
Returns
-
stringWCS projection code.
Source
hmsDMSToLatLng(Coordinate) → {leaflet.LatLng|undefined}
Convert an HMSDMS string to world coordinates.
Parameters
-
Coordinate
stringstring in HMSDMS.
Returns
-
leaflet.LatLngundefinedWorld coordinates, or
undefinedif 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.LatLngInput world coordinates.
Returns
-
stringCoordinate 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.LatLngInput world coordinates.
Returns
-
numberIndex of the closest chip (extension).
Source
multiLatLngToPoint(latlng, zoom) → {leaflet.Point}
Multi-WCS version of the projection to layer coordinates.
Parameters
-
latlng
leaflet.LatLngInput world coordinates.
-
zoom
numberZoom level.
Returns
-
leaflet.PointLayer 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.PointInput (merged) pixel coordinates.
Returns
-
numberIndex of the closest chip (extension).
Source
multiPointToLatLng(pnt, zoom) → {leaflet.LatLng}
Multi-WCS version of the de-projection from layer coordinates.
Parameters
-
pnt
leaflet.PointInput layer coordinates at the given zoom level.
-
zoom
numberZoom level.
Returns
-
leaflet.LatLngDe-projected world coordinates.
Source
multiProject(latlng) → {leaflet.Point}
Multi-WCS astrometric projection.
Parameters
-
latlng
leaflet.LatLngInput world coordinates.
Returns
-
leaflet.PointProjected (merged) pixel coordinates.
Source
multiUnproject(pnt) → {leaflet.LatLng}
Multi-WCS version of the astrometric de-projection.
Parameters
-
pnt
leaflet.PointInput (merged) pixel coordinates.
Returns
-
leaflet.LatLngDe-projected world coordinates.
Source
parseCoords(str) → {leaflet.LatLng|undefined}
Parse a string of world coordinates.
Parameters
-
str
stringInput string.
Returns
-
leaflet.LatLngundefinedWorld coordinates, or
undefinedif conversion failed.
Source
pixelScale(zoom, latlng) → {number}
Compute the layer pixel scale at the given world coordinates.
Parameters
-
zoom
numberZoom level.
-
latlng
leaflet.LatLngWorld coordinates.
Returns
-
numberLayer pixel scale (in degrees per pixel).
Source
rawPixelScale(latlng) → {number}
Compute the image pixel scale at the given world coordinates.
Parameters
-
latlng
leaflet.LatLngWorld coordinates.
Returns
-
numberPixel scale (in degrees per pixel).
Source
scale(zoom) → {number}
Convert zoom level to relative scale.
Parameters
-
zoom
numberZoom level.
Returns
-
numberRelative scale.
Source
transform(pnt, zoom) → {leaflet.Point}
Convert pixel (image) coordinates to layer coordinates.
Parameters
-
pnt
leaflet.PointPixel coordinates.
-
zoom
numberZoom level.
Returns
-
leaflet.PointLayer coordinates at the given zoom level.
Source
untransform(layerpnt, zoom) → {leaflet.Point}
Convert layer coordinates to pixel (image) coordinates.
Parameters
-
layerpnt
leaflet.PointLayer coordinates.
-
zoom
numberZoom level.
Returns
-
leaflet.PointPixel (image) coordinates
Source
zoom(scale) → {number}
Convert relative scale to zoom level.
Parameters
-
scale
numberRelative scale.
Returns
-
numberZoom level.
Source
zoomToFov(map, zoom, latlng) → {number}
Compute the FoV that corresponds to a given zoom level at the provided coordinates.
Parameters
-
map
leaflet.MapLeaflet map.
-
zoom
numberZoom level.
-
latlng
leaflet.LatLngWorld coordinates.
Returns
-
numberField of View in degrees.