{"id":26409102,"url":"https://github.com/lloydevans/hips2fits-js","last_synced_at":"2026-05-17T12:05:28.860Z","repository":{"id":57264336,"uuid":"287950590","full_name":"lloydevans/hips2fits-js","owner":"lloydevans","description":"A JS interface to the CDS hips2fits service.","archived":false,"fork":false,"pushed_at":"2020-09-04T19:10:43.000Z","size":2320,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T04:17:54.568Z","etag":null,"topics":["astronomy","hips","hips2fits","image","image-processing","node","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lloydevans.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-16T13:38:00.000Z","updated_at":"2020-12-02T10:25:15.000Z","dependencies_parsed_at":"2022-08-25T02:52:05.727Z","dependency_job_id":null,"html_url":"https://github.com/lloydevans/hips2fits-js","commit_stats":null,"previous_names":["lloydevans/node-hips2fits"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydevans%2Fhips2fits-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydevans%2Fhips2fits-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydevans%2Fhips2fits-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydevans%2Fhips2fits-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lloydevans","download_url":"https://codeload.github.com/lloydevans/hips2fits-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244094273,"owners_count":20397020,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astronomy","hips","hips2fits","image","image-processing","node","typescript"],"created_at":"2025-03-17T19:18:58.642Z","updated_at":"2026-05-17T12:05:23.823Z","avatar_url":"https://github.com/lloydevans.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[hips2fits-js](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/README.md)\n\n# hips2fits-js\n\n\nSimple utility for requesting data from the CDS hips2fits service.\n\nThis package provides both ES and CJS module formats.\n\nIt is ES5 compatible, however it does not provide any polyfills.\n\nIt's a simple setup - Use the `getImage` or `getImageUrl` functions, which take the [HipsOptions](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/interfaces/hipsoptions.md) object.\n\nDocumentions on the service can be found [here](http://alasky.u-strasbg.fr/hips-image-services/hips2fits).\n\n\u003cspan style=\"display:block;text-align:center\"\u003e![alt text](https://lloydevans.github.io/hips2fits-js/resources/cutout-CDS_P_Mellinger_color.png)\u003c/span\u003e\n\n## Installation\n\n`npm i -S hips2fits-js`\n\n## Index\n\n### Enumerations\n\n* [HipsCoordsys](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/enums/hipscoordsys.md)\n* [HipsImageFormat](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/enums/hipsimageformat.md)\n* [HipsProjection](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/enums/hipsprojection.md)\n* [HipsService](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/enums/hipsservice.md)\n* [HipsStretch](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/enums/hipsstretch.md)\n\n### Interfaces\n\n* [HipsOptions](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/interfaces/hipsoptions.md)\n* [WcsDict](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/interfaces/wcsdict.md)\n\n### Functions\n\n* [getImage](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/README.md#getimage)\n* [getImageUrl](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/README.md#getimageurl)\n* [parseWcs](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/README.md#parsewcs)\n\n## Functions\n\n###  getImage\n\n▸ **getImage**(`options`: [HipsOptions](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/interfaces/hipsoptions.md), `endPoint?`: string): *Promise‹Uint8Array›*\n\n*Defined in [get-image.ts:59](https://github.com/lloydevans/node-hips2fits/blob/7099203/src/get-image.ts#L59)*\n\nGet an image from the hips2fits service.\n\n**`example`** \n\n```js\nconst { writeFile } = require(\"fs\").promises;\n\nconst {\n  getImage,\n  HipsImageFormat,\n  HipsProjection,\n  HipsService,\n  HipsStretch,\n  HipsCoordsys,\n} = require(\"hips2fits-js\");\n\n(async function () {\n  let data;\n\n  try {\n    data = await getImage({\n      hips: HipsService.CDS_P_DSS2_color,\n      coordsys: HipsCoordsys.Icrs,\n      projection: HipsProjection.Car,\n      stretch: HipsStretch.Asinh,\n      format: HipsImageFormat.Png,\n      width: 2048 / 4,\n      height: 1024 / 4,\n      ra: 0,\n      dec: 0,\n      fov: 360,\n    });\n\n    await writeFile(\"image.png\", data);\n  } catch (error) {\n    console.log(error);\n    return;\n  }\n\n})();\n```\n\n**Parameters:**\n\nName | Type | Description |\n------ | ------ | ------ |\n`options` | [HipsOptions](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/interfaces/hipsoptions.md) | Options object configuring the Hips image generated. |\n`endPoint?` | string | Base URL endpoint.  |\n\n**Returns:** *Promise‹Uint8Array›*\n\n___\n\n###  getImageUrl\n\n▸ **getImageUrl**(`options`: [HipsOptions](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/interfaces/hipsoptions.md), `endPoint`: string): *string*\n\n*Defined in [get-image-url.ts:56](https://github.com/lloydevans/node-hips2fits/blob/7099203/src/get-image-url.ts#L56)*\n\nGet an image URL from the hips2fits service.\n\n**`example`** \n\n```js\nimport {\n  getImageUrl,\n  HipsImageFormat,\n  HipsProjection,\n  HipsService,\n  HipsStretch,\n  HipsCoordsys,\n} from \"hips2fits-js\";\n\nlet url;\nlet width = 1024;\nlet height = 512;\n\nurl = getImageUrl({\n  hips: HipsService.CDS_P_DSS2_color,\n  coordsys: HipsCoordsys.Icrs,\n  projection: HipsProjection.Car,\n  stretch: HipsStretch.Asinh,\n  format: HipsImageFormat.Png,\n  width,\n  height,\n  ra: 0,\n  dec: 0,\n  fov: 360,\n});\n\nlet img = new Image();\nimg.width = width;\nimg.height = height;\nimg.src = url;\n\nwindow.addEventListener(\"load\", function () {\n  window.document.body.appendChild(img);\n});\n```\n\n**Parameters:**\n\nName | Type | Default | Description |\n------ | ------ | ------ | ------ |\n`options` | [HipsOptions](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/interfaces/hipsoptions.md) | - | Options object configuring the Hips image generated. |\n`endPoint` | string | DEFAULT_ENDPOINT | Base URL endpoint.  |\n\n**Returns:** *string*\n\n___\n\n###  parseWcs\n\n▸ **parseWcs**(`wcsString`: string): *[WcsDict](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/interfaces/wcsdict.md)*\n\n*Defined in [parse-wcs.ts:30](https://github.com/lloydevans/node-hips2fits/blob/7099203/src/parse-wcs.ts#L30)*\n\nParse a WCS configuration string.\n\n**`example`** \n\n```js\nlet wcs = `\nNAXIS1  =                 2000\nNAXIS2  =                 1000\nWCSAXES =                    2 / Number of coordinate axes\nCRPIX1  =               1000.0 / Pixel coordinate of reference point\nCRPIX2  =                500.0 / Pixel coordinate of reference point\nCDELT1  =                -0.18 / [deg] Coordinate increment at reference point\nCDELT2  =                 0.18 / [deg] Coordinate increment at reference point\nCUNIT1  = 'deg'                / Units of coordinate increment and value\nCUNIT2  = 'deg'                / Units of coordinate increment and value\nCTYPE1  = 'GLON-MOL'           / galactic longitude, Mollweide's projection\nCTYPE2  = 'GLAT-MOL'           / galactic latitude, Mollweide's projection\nCRVAL1  =                  0.0 / [deg] Coordinate value at reference point\nCRVAL2  =                  0.0 / [deg] Coordinate value at reference point\n`;\n\nlet wcsDict = parseWcs(wcs);\n```\n\n**Parameters:**\n\nName | Type | Description |\n------ | ------ | ------ |\n`wcsString` | string |   |\n\n**Returns:** *[WcsDict](https://github.com/lloydevans/hips2fits-js/blob/master/docs/md/interfaces/wcsdict.md)*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flloydevans%2Fhips2fits-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flloydevans%2Fhips2fits-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flloydevans%2Fhips2fits-js/lists"}