Organise imports in tileserver

This commit is contained in:
Maciej Ziarkowski 2019-11-07 07:48:51 +00:00
parent 175d3236eb
commit 8019e77200
8 changed files with 22 additions and 21 deletions

View File

@ -1,4 +1,5 @@
import { strictParseInt } from "../parse";
import { DataConfig } from "./types";
const BUILDING_LAYER_DEFINITIONS = {

View File

@ -1,11 +1,11 @@
import { TileCache } from "./tileCache";
import { BoundingBox, TileParams, Tile } from "./types";
import { getBuildingsDataConfig, getHighlightDataConfig, getAllLayerNames, getBuildingLayerNames } from "./dataDefinition";
import { isOutsideExtent } from "./util";
import { renderDataSourceTile } from "./renderers/renderDataSourceTile";
import { getTileWithCaching } from "./renderers/getTileWithCaching";
import { stitchTile } from "./renderers/stitchTile";
import { getAllLayerNames, getBuildingLayerNames, getBuildingsDataConfig, getHighlightDataConfig } from "./dataDefinition";
import { createBlankTile } from "./renderers/createBlankTile";
import { getTileWithCaching } from "./renderers/getTileWithCaching";
import { renderDataSourceTile } from "./renderers/renderDataSourceTile";
import { stitchTile } from "./renderers/stitchTile";
import { TileCache } from "./tileCache";
import { BoundingBox, Tile, TileParams } from "./types";
import { isOutsideExtent } from "./util";
/**
* A list of all tilesets handled by the tile server

View File

@ -1,5 +1,5 @@
import { TileParams, RendererFunction, Tile } from "../types";
import { TileCache } from "../tileCache";
import { RendererFunction, Tile, TileParams } from "../types";
async function getTileWithCaching(tileParams: TileParams, dataParams: any, tileCache: TileCache, renderTile: RendererFunction): Promise<Tile> {

View File

@ -1,11 +1,10 @@
import path from 'path';
import mapnik from "mapnik";
import { TileParams, Tile, TableDefinitionFunction } from "../types";
import { getBbox, TILE_SIZE } from "../util";
import path from 'path';
import { promisify } from "util";
import { TableDefinitionFunction, Tile, TileParams } from "../types";
import { getBbox, TILE_SIZE } from "../util";
const TILE_BUFFER_SIZE = 64;
const PROJ4_STRING = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over';

View File

@ -1,6 +1,6 @@
import sharp from 'sharp';
import { TileParams, RendererFunction, Tile } from "../types";
import { RendererFunction, Tile, TileParams } from "../types";
import { getBbox, getXYZ, TILE_SIZE } from "../util";

View File

@ -16,12 +16,12 @@
// Using node-fs package to patch fs
// for node >10 we could drop this in favour of fs.mkdir (which has recursive option)
// and then use stdlib `import fs from 'fs';`
import { Image } from 'mapnik';
import fs from 'node-fs';
import { promisify } from 'util'
import { Image } from 'mapnik';
import { TileParams, BoundingBox } from './types';
import { getXYZ, formatParams } from './util';
import { BoundingBox, TileParams } from './types';
import { formatParams, getXYZ } from './util';
// TODO: switch to modern node and use built-in fs with promise-based API
const readFile = promisify(fs.readFile),

View File

@ -5,10 +5,11 @@
*/
import express from 'express';
import { strictParseInt } from '../parse';
import { TileParams } from './types';
import { renderTile, allTilesets } from './rendererDefinition';
import asyncController from '../api/routes/asyncController';
import { strictParseInt } from '../parse';
import { allTilesets, renderTile } from './rendererDefinition';
import { TileParams } from './types';
const handleTileRequest = asyncController(async function (req: express.Request, res: express.Response) {
try {

View File

@ -1,6 +1,6 @@
import SphericalMercator from '@mapbox/sphericalmercator';
import { TileParams, BoundingBox } from './types';
import { BoundingBox, TileParams } from './types';
const TILE_SIZE = 256;