Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.

Commit ad3d237

Browse files
author
Jin IGARASHI
committed
upgraded modules for watergis's packages
1 parent 23abe65 commit ad3d237

File tree

5 files changed

+46
-37
lines changed

5 files changed

+46
-37
lines changed

config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
ghpages:{
2222
tiles: export_dir + '/public/tiles'
2323
},
24-
mbtiles: export_dir + '/narok.mbtiles',
24+
mbtiles: export_dir + '/data/narok.mbtiles',
2525
minzoom: 10,
2626
maxzoom: 16,
2727
layers : [

docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
version: '2'
22
services:
33
nodejs:
4-
image: narwassco/vt-map:v0.0.2
4+
image: narwassco/vt-map:v0.0.3
55
#build: .
66
env_file:
77
- ./app-docker.env
88
volumes:
99
- ./public:/tmp/src/vt-map/public
10+
- ./data:/tmp/src/vt-map/data
1011
- ./config.js:/tmp/src/vt-map/config.js
1112
- ./config-search.js:/tmp/src/vt-map/config-search.js

index.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1-
const postgis2mbtiles = require('postgis2mbtiles');
2-
const {Mbtiles2Pbf, FileExtension} = require('@watergis/mbtiles2pbf');
1+
const {postgis2vectortiles} = require('@watergis/postgis2vectortiles');
32
const {postgis2geojson} = require('@watergis/postgis2geojson');
43
const config = require('./config');
54
const configSearch = require('./config-search');
65

76
const VtMapCreator = () =>{
87
console.time('vt-map');
9-
//create geojson file for search function
10-
createGeoJSONSearch();
11-
12-
const pg2mbtiles = new postgis2mbtiles(config);
13-
const mbtiles2pbf = new Mbtiles2Pbf(config.mbtiles, config.ghpages.tiles, FileExtension.MVT);
14-
pg2mbtiles.run()
15-
.then(res=>{return mbtiles2pbf.run()})
16-
.catch(err=>{console.log(err);}).finally(()=>{
8+
const pg2vt = new postgis2vectortiles(config);
9+
pg2vt.create(config.ghpages.tiles)
10+
.then(res=>{
11+
console.log(`Created ${res.no_tiles} vectortiles under folder: ${res.output}`);
12+
//create geojson file for search function
13+
const pg2json = new postgis2geojson(configSearch);
14+
return pg2json.run();
15+
})
16+
.then(files=>{files.forEach(f=>{
17+
console.log(`Created GeoJSON file:${f}`);
18+
console.log('Now you are ready to command "npm run deploy" to push vectortiles to gh-pages.');
19+
});})
20+
.catch(err=>{console.log(err);})
21+
.finally(()=>{
1722
console.timeEnd('vt-map');
1823
})
1924
};
2025

21-
const createGeoJSONSearch = async() =>{
22-
const pg2json = new postgis2geojson(configSearch);
23-
const files = await pg2json.run();
24-
files.forEach(f=>{console.log(f)});
25-
}
26-
2726
module.exports = VtMapCreator();

package-lock.json

Lines changed: 25 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
},
2020
"homepage": "https://github.com/narwassco/vt-map#readme",
2121
"dependencies": {
22-
"@watergis/mbtiles2pbf": "^0.0.2",
23-
"@watergis/postgis2geojson": "^0.1.1",
24-
"dotenv": "^8.2.0",
25-
"postgis2mbtiles": "git+https://github.com/narwassco/postgis2mbtiles.git"
22+
"@watergis/postgis2geojson": "^0.1.6",
23+
"@watergis/postgis2vectortiles": "^0.1.3",
24+
"dotenv": "^8.2.0"
2625
},
2726
"devDependencies": {
2827
"gh-pages": "^3.0.0"

0 commit comments

Comments
 (0)