Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
mptr committed Jan 18, 2022
0 parents commit 09b5e3b
Show file tree
Hide file tree
Showing 24 changed files with 4,139 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.mbtiles
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:14 as font-builder

RUN mkdir -p /output
RUN git clone --single-branch --branch master https://github.com/mapbox/node-fontnik.git
WORKDIR node-fontnik
RUN npm ci
COPY font-builder .
RUN set -ex \
&& node process.js input


FROM maptiler/tileserver-gl

COPY --from=font-builder /output /data/fonts
COPY styles /data/styles
COPY maptiler-config.json /data/config.json
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Map-Tile Server for Lume

## Build

The build process automatically imports styles and fonts into the docker image.
To build run `docker build .`

## Run

For the Tile Server to run, you first need to download the mbtiles data on your worker. The file is obtainable at [data.maptiler.com](https://data.maptiler.com/downloads/planet/).

Once you have the mbtiles file ready, start the container with:
```sh
docker run \
--rm -it \
-v $(pwd)/<yourfile>.mbtiles:/data/mapdata.mbtiles \
-p 8080:8080 \
<docker-img-tag>
```
You may need to modify the ``pwd`` in the above command if the mbtiles file is not in your current working directory.
Binary file added font-builder/input/Domus_Tilting.otf
Binary file not shown.
Binary file added font-builder/input/Domus_Tilting_Bold.otf
Binary file not shown.
Binary file added font-builder/input/Domus_Tilting_Extrabold.otf
Binary file not shown.
Binary file added font-builder/input/Domus_Tilting_Extralight.otf
Binary file not shown.
Binary file added font-builder/input/Domus_Tilting_Light.otf
Binary file not shown.
Binary file added font-builder/input/Domus_Tilting_Medium.otf
Binary file not shown.
Binary file added font-builder/input/Domus_Tilting_Semibold.otf
Binary file not shown.
Binary file added font-builder/input/Nexusa-Next-Bold-Italic.otf
Binary file not shown.
Binary file added font-builder/input/Nexusa-Next-Bold.otf
Binary file not shown.
Binary file added font-builder/input/Nexusa-Next-Italic.otf
Binary file not shown.
Binary file added font-builder/input/Nexusa-Next-Light-Italic.otf
Binary file not shown.
Binary file added font-builder/input/Nexusa-Next-Light.otf
Binary file not shown.
Binary file added font-builder/input/Nexusa-Next-Medium-Italic.otf
Binary file not shown.
Binary file added font-builder/input/Nexusa-Next-Medium.otf
Binary file not shown.
Binary file added font-builder/input/Nexusa-Next-Thin-Italic.otf
Binary file not shown.
Binary file added font-builder/input/Nexusa-Next-Thin.otf
Binary file not shown.
Binary file added font-builder/input/Nexusa-Next.otf
Binary file not shown.
41 changes: 41 additions & 0 deletions font-builder/process.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
var fontnik = require(".");
var fs = require("fs");
var path = require("path");

var convert = function (fileName, outputDir) {
var font = fs.readFileSync(path.resolve(__dirname + "/" + fileName));
fs.mkdir(outputDir, {recursive:true}, () =>
output2pbf(font, 0, 255, outputDir)
);
};
function output2pbf(font, start, end, outputDir) {
if (start > 65535) {
console.log("done!");
return;
}
fontnik.range({ font: font, start: start, end: end }, function (err, res) {
var outputFilePath = path.resolve(
outputDir + "/" + start + "-" + end + ".pbf"
);
fs.writeFile(outputFilePath, res, function (err) {
if (err) {
console.error(err);
} else {
output2pbf(font, end + 1, end + 1 + 255, outputDir);
}
});
});
}

var process = require("process");
var args = process.argv.slice(2);

fs.readdir(args[0], (err, files) => {
files.forEach((file) => {
convert(
args[0].replace(/\/$/, "") + "/" + file,
"/output/" + file.replace(/\.(otf|ttf)$/, "")
);
console.log("converted", file);
});
});
23 changes: 23 additions & 0 deletions maptiler-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"options": {
"paths": {
"root": "/app/node_modules/tileserver-gl-styles",
"fonts": "/data/fonts",
"styles": "/data/styles",
"mbtiles": "/data"
}
},
"styles": {
"dark": {
"style": "/data/styles/dark.json"
},
"light": {
"style": "/data/styles/light.json"
}
},
"data": {
"v3": {
"mbtiles": "mapdata.mbtiles"
}
}
}
Loading

0 comments on commit 09b5e3b

Please sign in to comment.