refactor: only pass back metadata
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
This commit is contained in:
parent
5ce9dddf0d
commit
a5cc66729d
4 changed files with 4 additions and 7 deletions
|
|
@ -128,8 +128,7 @@ const startWithinputFile = async (inputFile) => {
|
||||||
const extension = inputFile.split('.').pop().toLowerCase();
|
const extension = inputFile.split('.').pop().toLowerCase();
|
||||||
if (extension === 'pmtiles') {
|
if (extension === 'pmtiles') {
|
||||||
let FileOpenInfo = PMtilesOpen(inputFile);
|
let FileOpenInfo = PMtilesOpen(inputFile);
|
||||||
const info = await GetPMtilesInfo(FileOpenInfo.pmtiles);
|
const metadata = await GetPMtilesInfo(FileOpenInfo.pmtiles);
|
||||||
const metadata = info.metadata;
|
|
||||||
if (FileOpenInfo.fd !== undefined) {
|
if (FileOpenInfo.fd !== undefined) {
|
||||||
PMtilesClose(FileOpenInfo.fd);
|
PMtilesClose(FileOpenInfo.fd);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ export const GetPMtilesInfo = async (pmtiles) => {
|
||||||
metadata['maxzoom'] = header.maxZoom;
|
metadata['maxzoom'] = header.maxZoom;
|
||||||
metadata['format'] = GetPmtilesTileType(header.tileType).type;
|
metadata['format'] = GetPmtilesTileType(header.tileType).type;
|
||||||
|
|
||||||
return { header: header, metadata: metadata };
|
return metadata;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const GetPMtilesTile = async (pmtiles, z, x, y) => {
|
export const GetPMtilesTile = async (pmtiles, z, x, y) => {
|
||||||
|
|
|
||||||
|
|
@ -226,8 +226,7 @@ export const serve_data = {
|
||||||
let source_type;
|
let source_type;
|
||||||
if (inputType === 'pmtiles') {
|
if (inputType === 'pmtiles') {
|
||||||
let FileOpenInfo = PMtilesOpen(inputFile);
|
let FileOpenInfo = PMtilesOpen(inputFile);
|
||||||
const info = await GetPMtilesInfo(FileOpenInfo.pmtiles);
|
const metadata = await GetPMtilesInfo(FileOpenInfo.pmtiles);
|
||||||
const metadata = info.metadata;
|
|
||||||
source = FileOpenInfo.pmtiles;
|
source = FileOpenInfo.pmtiles;
|
||||||
source_type = 'pmtiles';
|
source_type = 'pmtiles';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1503,8 +1503,7 @@ export const serve_rendered = {
|
||||||
|
|
||||||
if (source_type === 'pmtiles') {
|
if (source_type === 'pmtiles') {
|
||||||
let FileOpenInfo = PMtilesOpen(inputFile);
|
let FileOpenInfo = PMtilesOpen(inputFile);
|
||||||
const info = await GetPMtilesInfo(FileOpenInfo.pmtiles);
|
const metadata = await GetPMtilesInfo(FileOpenInfo.pmtiles);
|
||||||
const metadata = info.metadata;
|
|
||||||
map.sources[name] = FileOpenInfo.pmtiles;
|
map.sources[name] = FileOpenInfo.pmtiles;
|
||||||
map.source_types[name] = 'pmtiles';
|
map.source_types[name] = 'pmtiles';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue