Functions that construct URLs for external services. Most of the functions here just do string manipulation to build up URL strings, using knowledge of the parameters required for various services.
urlEncode( txt )
_
"),
minus sign ("-
"),
period (".
") and
tilde ("~
") are passed through unchanged,
and any other 7-bit ASCII character is represented by a percent sign
("%
") followed by its 2-digit hexadecimal code.
Characters with values of 128 or greater are simply dropped.
txt
(String): input (unencoded) stringurlEncode("RR Lyr") = "RR%20Lyr"
urlDecode( txt )
urlEncode
.
Percent-encoded sequences (%xx
) are replaced
by the ASCII character with the hexadecimal code xx
.
txt
(String): input (encoded) stringurlDecode("RR%20Lyr") = "RR Lyr"
paramsUrl( baseUrl, nameValuePairs, ... )
The parameters are encoded on the command line according to the
"application/x-www-form-urlencoded
" convention,
which appends a "?" to the base URL, and then adds name=value pairs
separated by "&" characters, with percent-encoding of
non-URL-friendly characters.
This format is used by many services that require a list of parameters
to be conveyed on the URL.
baseUrl
(String): basic URL (may or may not already contain a "?")nameValuePairs
(String, one or more): an even number of arguments
(or an even-length string array) giving
parameter name1,value1,name2,value2,...nameN,valueNparamsUrl("http://x.org/", "a", "1", "b", "two", "c", "3&4")
= "http://x.org/?a=1&b=two&c=3%264"
bibcodeUrl( bibcode )
If the supplied string appears to be a bibcode,
it just prepends the string
"https://ui.adsabs.harvard.edu/abs/
"
and performs any character escaping that is required.
bibcode
(String): ADS-style bibcode stringbibcodeUrl("2018A&A...616A...2L") =
"https://ui.adsabs.harvard.edu/abs/2018A%26A...616A...2L"
doiUrl( doi )
If the supplied string appears to be a DOI,
it strips any "doi:
" prefix if present,
prepends the string "https://doi.org/
",
and performs any character escaping that is required.
doi
(String): DOI string, with or without "doi:" prefixdoiUrl("10.3390/informatics4030018") =
"https://doi.org/10.3390/informatics4030018"
arxivUrl( arxivId )
If the supplied string appears to be an arXiv identifier,
it strips any "arXiv:
prefix
and prepends the string "https://arxiv.org/abs/
".
arxivId
(String): arXiv identifier, with or without "arXiv:" prefixarxivUrl("arXiv:1804.09379") =
"https://arxiv.org/abs/1804.09381"
simbadUrl( sourceId )
The string
"http://simbad.u-strasbg.fr/simbad/sim-id?Ident=
"
is prepended to the given id string, and any necessary character
escaping is applied.
No attempt is made to validate whether the supplied string is
a real source identifier, so there is no guarantee that the
returned URL will contain actual results.
sourceId
(String): free text assumed to represent a source identifier
known by SIMBADsimbadUrl("Beta Pictoris") =
"http://simbad.u-strasbg.fr/simbad/sim-id?Ident=Beta%20Pictoris"
nedUrl( sourceId )
The string
"http://ned.ipac.caltech.edu/byname?objname=
"
is prepended to the given id string, and any necessary character
escaping is applied.
No attempt is made to validate whether the supplied string is
a real source identifier, so there is no guarantee that the
returned URL will contain actual results.
sourceId
(String): free text assumed to represent a source identifier
known by NEDnedUrl("NGC 3952") =
"http://ned.ipac.caltech.edu/byname?objname=NGC%203952"
hips2fitsUrl( hipsId, fmt, raDeg, decDeg, fovDeg, npix )
This function requests a square cutout using the SIN projection, which is suitable for small cutouts. If the details of this function don't suit your purposes, you can construct the URL yourself.
hipsId
(String): identifier or partial identifier for the HiPS surveyfmt
(String): required output format, for instance
"fits
", "png
",
"jpg
"raDeg
(floating point): central Right Ascension (longitude) in degreesdecDeg
(floating point): central Declination (latitude) in degreesfovDeg
(floating point): field of view; extent of the cutout in degreesnpix
(integer): extent of the cutout in pixels (width=height=npix)