Skip to content

Commit

Permalink
fix deal with uncompressed tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
sfggeogis committed Feb 18, 2021
1 parent b5c0ccb commit ca001fc
Show file tree
Hide file tree
Showing 50 changed files with 42,445 additions and 38,982 deletions.
21 changes: 11 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Dependency directories
node_modules/
jspm_packages/
temp/
geojson-vt/
.vscode
*.qgs*
*.qgd
*.mbtiles
*.log
# Dependency directories
node_modules/
jspm_packages/
temp/
geojson-vt/
.vscode
*.qgs*
*.qgd
*.mbtiles
*.log
token.txt
22 changes: 11 additions & 11 deletions CAT_plus_box.geojson

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions CAT_plus_box_multi.geojson

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License

Copyright (c) 2018 ICGC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2018 ICGC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 8 additions & 8 deletions Linea_CAT_limits5M_abril_2018.geojson

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Poligon_CAT_limits5M_abril_2018.geojson

Large diffs are not rendered by default.

142 changes: 72 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,72 @@
# Tile Stitch
Tile Stitch is a tool aimed at replacing tiles inside a given mbttiles file with tiles from another set of tiles, using a polygon to mask the stitching area and merge if needed contents from both sets of boundary tiles.

## Getting Started


### Prerequisites

This project in based on [NodeJs](https://nodejs.org/en/)

### Installation

```
git clone https://github.com/gencat/ICGC-tile-stitch.git
cd ICGC-tile-stitch
npm install
```


### Configuration

Edit *config.js*

```
f.mbtiles_ori = './icgc.mbtiles'; // your local tiles
_f.mbtiles_dest = './europe_spain.mbtiles'; // Country Mbtiles from OpenMaptiles
_f.pol_cat = './CAT_plus_box.geojson'; //clipping polygon
_f.mbtiles_planet = './planet.mbtiles'; //full planet from OpenMaptiles
_f.zoom_levels = [7,8,9,10,11,12,13,14]; //replace zoom levels
```

### Running

#### To create stitched tiles

```
./stitch.sh
```
#### To replace your local stitched tiles into country tiles


```
node mergeMbtiles.js
```

#### To replace your country tiles into planet tiles


```
node mergePlanet.js
```

## Authors

* [Institut Cartogràfic i Geològic de Catalunya](https://www.icgc.cat/)


## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details


# Tile Stitch
Tile Stitch is a tool aimed at replacing tiles inside a given mbttiles file with tiles from another set of tiles, using a polygon to mask the stitching area and merge if needed contents from both sets of boundary tiles.

## Getting Started


### Prerequisites

This project in based on [NodeJs](https://nodejs.org/en/)

This project use [Tippecanoe](https://github.com/mapbox/tippecanoe) and [GDAL](https://gdal.org/)

### Installation

```
git clone https://github.com/gencat/ICGC-tile-stitch.git
cd ICGC-tile-stitch
npm install
```


### Configuration

Edit *config.js*

```
f.mbtiles_ori = './icgc.mbtiles'; // your local tiles
_f.mbtiles_dest = './europe_spain.mbtiles'; // Country Mbtiles from OpenMaptiles
_f.pol_cat = './CAT_plus_box.geojson'; //clipping polygon
_f.mbtiles_planet = './planet.mbtiles'; //full planet from OpenMaptiles
_f.zoom_levels = [7,8,9,10,11,12,13,14]; //replace zoom levels
```

### Running

#### To create stitched tiles

```
./stitch.sh
```
#### To replace your local stitched tiles into country tiles


```
node mergeMbtiles.js
```

#### To replace your country tiles into planet tiles


```
node mergePlanet.js
```

## Authors

* [Institut Cartogràfic i Geològic de Catalunya](https://www.icgc.cat/)


## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details


2 changes: 1 addition & 1 deletion comando.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
tippecanoe -o 12_2055_1508.mbtiles --one-tile=12/2055/1508 -L landcover:landcover.geojson -L park:park.geojson -L landuse:landuse.geojson -L building:building.geojson -L waterway:waterway.geojson -L transportation:transportation.geojson -L boundary:boundary.geojson -L mountain_peak:mountain_peak.geojson -L place:place.geojson
tippecanoe -o 12_2055_1508.mbtiles --one-tile=12/2055/1508 -L landcover:landcover.geojson -L park:park.geojson -L landuse:landuse.geojson -L building:building.geojson -L waterway:waterway.geojson -L transportation:transportation.geojson -L boundary:boundary.geojson -L mountain_peak:mountain_peak.geojson -L place:place.geojson
9 changes: 6 additions & 3 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ if (_platform.indexOf('Windows') != -1) {
};
var _f = JSON.parse(fs.readFileSync(fileProp, 'utf8'));

_f.mbtiles_ori = './icgc.mbtiles';
_f.mbtiles_dest = './europe_spain.mbtiles';
_f_origen_comprimid= true;
_f.mbtiles_ori = './ctxmaps_demo_febrer.mbtiles';

//_f.mbtiles_ori = './bt25m_vector_7a14.mbtiles';
_f.mbtiles_dest = './2017-07-03_europe_spain.mbtiles';
//_f.pol_cat = './Poligon_CAT_limits5M_abril_2018.geojson';
_f.pol_cat = './CAT_plus_box.geojson';
_f.mbtiles_dest_source = './europe_spain_Copy.mbtiles';
_f.mbtiles_planet = './planet.mbtiles';
_f.mbtiles_planet = './2017-07-03_planet_z0_z14.mbtiles';
_f.zoom_levels = [7,8,9,10,11,12,13,14];
//_f.zoom_levels = [7];

Expand Down
24 changes: 12 additions & 12 deletions copyDestino.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const fs = require('fs');

fs.createReadStream('2017-07-03_europe_spain - Copy.mbtiles').pipe(fs.createWriteStream('2017-07-03_europe_spain.mbtiles'));

/*
function copyDestino(){
return new Promise(function(resolve, reject) {
fs.writeFileSync('2017-07-03_europe_spain.mbtiles', fs.readFileSync('2017-07-03_europe_spain - Copy.mbtiles'));
//fs.createReadStream('2017-07-03_europe_spain - Copy.mbtiles').pipe(fs.createWriteStream('2017-07-03_europe_spain.mbtiles'));
resolve();
});
}
const fs = require('fs');

fs.createReadStream('2017-07-03_europe_spain - Copy.mbtiles').pipe(fs.createWriteStream('2017-07-03_europe_spain.mbtiles'));

/*
function copyDestino(){
return new Promise(function(resolve, reject) {
fs.writeFileSync('2017-07-03_europe_spain.mbtiles', fs.readFileSync('2017-07-03_europe_spain - Copy.mbtiles'));
//fs.createReadStream('2017-07-03_europe_spain - Copy.mbtiles').pipe(fs.createWriteStream('2017-07-03_europe_spain.mbtiles'));
resolve();
});
}
*/
Loading

0 comments on commit ca001fc

Please sign in to comment.