-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(server): correct eslint errors
- Loading branch information
1 parent
d4546fb
commit 40056fb
Showing
2 changed files
with
33 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
import { BasemapsConfigProvider, getAllImagery, } from '@basemaps/config'; | ||
import { BasemapsConfigProvider, getAllImagery } from '@basemaps/config'; | ||
import { Epsg } from '@basemaps/geo'; | ||
import { getPreviewUrl } from '@basemaps/shared'; | ||
|
||
/** | ||
* If a tileset layer of the given id and projection exists, this function returns a Basemaps URL | ||
* path that is already zoomed to the extent of the tileset. Otherwise, this function returns null. | ||
* | ||
* | ||
* @param id - The id of the tileset. | ||
* @example "ashburton-2023-0.1m" | ||
* | ||
* | ||
* @param projection - The projection from the tileset's layers to consider. | ||
* @example Epsg.Google = 3857 | ||
*/ | ||
export async function getTileSetPath(cfg: BasemapsConfigProvider, id: string, projection: Epsg): Promise<string | null> { | ||
const tileSet = await cfg.TileSet.get(id) | ||
if (!tileSet) return null | ||
export async function getTileSetPath( | ||
cfg: BasemapsConfigProvider, | ||
id: string, | ||
projection: Epsg, | ||
): Promise<string | null> { | ||
const tileSet = await cfg.TileSet.get(id); | ||
if (!tileSet) return null; | ||
|
||
const imageryMap = await getAllImagery(cfg, tileSet.layers, [projection]); | ||
const imageryMap = await getAllImagery(cfg, tileSet.layers, [projection]); | ||
|
||
const [_, imagery] = Array.from(imageryMap)[0] | ||
if (!imagery) return null | ||
const imagery = [...imageryMap.values()][0]; | ||
if (!imagery) return null; | ||
|
||
const url = getPreviewUrl({ imagery }) | ||
return (`${url.slug}?i=${url.name}`) | ||
const url = getPreviewUrl({ imagery }); | ||
|
||
return `${url.slug}?i=${url.name}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters