22 lines
532 B
TypeScript
22 lines
532 B
TypeScript
|
import { route } from 'docuri';
|
||
|
|
||
|
/**
|
||
|
* A [docuri](https://github.com/jo/docuri) route for {@link components/map/types!TileKeyObject}
|
||
|
*
|
||
|
* TODO: update docuri (or write a wrapper) to support datatyping (and formats).
|
||
|
*/
|
||
|
export const tileUri = (rte: any) => {
|
||
|
const r = route('tile/:provider/:zoomLevel/:x/:y')(rte);
|
||
|
if (typeof r === 'object') {
|
||
|
return {
|
||
|
provider: r.provider,
|
||
|
zoomLevel: parseInt(r.zoomLevel),
|
||
|
x: parseInt(r.x),
|
||
|
y: parseInt(r.y),
|
||
|
};
|
||
|
}
|
||
|
return r;
|
||
|
};
|
||
|
|
||
|
export default tileUri;
|