Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use finer source #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions gulp/maps/countries-coastline.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const utils = require('../utils');
* the countries coastline boundaries in a single file.
*/
gulp.task('countries-coastline-generate', async () => {
const coastlinePath = path.join(folders.mapsDir, 'countries-coastline.geo.json');
const maritimePath = path.join(folders.mapsDir, 'countries-maritime.geo.json');
const coastlinesPath = path.join(folders.mapsDir, 'earth-coastlines.geo.json');
const coastlinePath = path.join(folders.mapsDir, 'countries-coastline.shp');
const maritimePath = path.join(folders.mapsDir, 'countries-maritime.shp');
const coastlinesPath = path.join(folders.mapsDir, 'earth-coastlines.shp');

const cmd = '-i ' + maritimePath + ' ' +
'-clip ' + coastlinesPath + ' ' +
'-o precision=0.000001 format=geojson ' + coastlinePath + ' ' +
'-o format=shapefile ' + coastlinePath + ' ' +
'-verbose';
await utils.mapshaperCmd(cmd);
});
8 changes: 4 additions & 4 deletions gulp/maps/countries-land.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const utils = require('../utils');
* the countries coastline boundaries in a single file.
*/
gulp.task('countries-land-generate', async () => {
const landPath = path.join(folders.mapsDir, 'countries-land.geo.json');
const maritimePath = path.join(folders.mapsDir, 'countries-maritime.geo.json');
const landsPath = path.join(folders.mapsDir, 'earth-lands.geo.json');
const landPath = path.join(folders.mapsDir, 'countries-land.shp');
const maritimePath = path.join(folders.mapsDir, 'countries-maritime.shp');
const landsPath = path.join(folders.mapsDir, 'earth-lands.shp');

const cmd = '-i ' + maritimePath + ' ' +
'-clip ' + landsPath + ' ' +
'-o precision=0.000001 format=geojson ' + landPath + ' ' +
'-o format=shapefile ' + landPath + ' ' +
'-verbose';
await utils.mapshaperCmd(cmd);
});
6 changes: 3 additions & 3 deletions gulp/maps/countries-maritime.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const utils = require('../utils');
* the countries maritime boundaries in a single file.
*/
gulp.task('countries-maritime-generate', async () => {
const maritimePath = path.join(folders.mapsDir, 'countries-maritime.geo.json');
const maritimePath = path.join(folders.mapsDir, 'countries-maritime.shp');
const mapPath = path.join(folders.tmpDir, 'countries-map.json');
const tmpMaritimePath = path.join(folders.tmpDir, 'countries-maritime.geo.json');

Expand All @@ -31,7 +31,7 @@ gulp.task('countries-maritime-generate', async () => {
await fs.outputJson(tmpMaritimePath, maritime);

const cmd = '-i ' + tmpMaritimePath + ' ' +
'-o precision=0.000001 format=geojson ' + maritimePath + ' ' +
'-verbose';
'-o format=shapefile ' + maritimePath + ' ' +
'-verbose';
await utils.mapshaperCmd(cmd);
});
13 changes: 6 additions & 7 deletions gulp/maps/earth-coastlines.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,24 @@ const utils = require('../utils');
* Creates a valid GeoJSON file from the OSM lakes map in the tmp folder.
*/
gulp.task('earth-coastlines-generate', async () => {
const landUrl = 'http://data.openstreetmapdata.com/simplified-land-polygons-complete-3857.zip';
const landUrl = 'http://data.openstreetmapdata.com/land-polygons-complete-3857.zip';
const coastlinesPath = path.join(folders.mapsDir, 'earth-coastlines.shp');
const tmpCoastlinesDir = path.join(folders.tmpDir, 'earth-coastlines');

const coastlinesPath = path.join(folders.mapsDir, 'earth-coastlines.geo.json');
const tmpCoastlinesDir = path.join(folders.tmpDir, 'earth-coeastlines');

const shpLandPath = path.join(tmpCoastlinesDir, 'simplified_land_polygons.shp');
const shpLandPath = path.join(tmpCoastlinesDir, 'land_polygons.shp');

const dwnOpts = {
extract: true,
strip: 1,
filter: file => file.path.indexOf('simplified_land_polygons') !== -1
filter: file => file.path.indexOf('land_polygons') !== -1
};
await download(landUrl, tmpCoastlinesDir, dwnOpts).on('response', utils.downloadProgress('earth-coastlines'));

const cmd = '-i ' + shpLandPath + ' ' +
'-filter-fields ' +
'-proj +init=epsg:4326 ' +
'-dissolve ' +
'-o precision=0.000001 format=geojson ' + coastlinesPath + ' ' +
'-o format=shapefile ' + coastlinesPath + ' ' +
'-verbose';
await utils.mapshaperCmd(cmd);

Expand Down
6 changes: 3 additions & 3 deletions gulp/maps/earth-lakes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const utils = require('../utils');
gulp.task('earth-lakes-generate', async () => {
const lakesUrl = 'http://data.openstreetmapdata.com/lakes-polygons-reduced-3857.zip';

const lakesPath = path.join(folders.mapsDir, 'earth-lakes.geo.json');
const lakesPath = path.join(folders.mapsDir, 'earth-lakes.shp');
const tmpLakesDir = path.join(folders.tmpDir, 'earth-lakes');

const shpLakesPath = path.join(tmpLakesDir, 'lakes_reduced_z5.shp');
const shpLakesPath = path.join(tmpLakesDir, 'lakes_reduced_z6.shp');

const dwnOpts = {
extract: true,
Expand All @@ -31,7 +31,7 @@ gulp.task('earth-lakes-generate', async () => {
'-filter-fields ' +
'-proj +init=epsg:4326 ' +
'-dissolve ' +
'-o precision=0.000001 format=geojson ' + lakesPath + ' ' +
'-o format=shapefile ' + lakesPath + ' ' +
'-verbose';
await utils.mapshaperCmd(cmd);

Expand Down
10 changes: 5 additions & 5 deletions gulp/maps/earth-lands.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ const utils = require('../utils');
* Creates a valid GeoJSON file from the OSM lakes map in the tmp folder.
*/
gulp.task('earth-lands-generate', async () => {
const landsPath = path.join(folders.mapsDir, 'earth-lands.geo.json');
const coastlinesPath = path.join(folders.mapsDir, 'earth-coastlines.geo.json');
const lakesPath = path.join(folders.mapsDir, 'earth-lakes.geo.json');
const riversPath = path.join(folders.mapsDir, 'earth-rivers.geo.json');
const landsPath = path.join(folders.mapsDir, 'earth-lands.shp');
const coastlinesPath = path.join(folders.mapsDir, 'earth-coastlines.shp');
const lakesPath = path.join(folders.mapsDir, 'earth-lakes.shp');
const riversPath = path.join(folders.mapsDir, 'earth-rivers.shp');

const cmd = '-i ' + coastlinesPath + ' ' +
'-erase ' + lakesPath + ' target=1 ' +
'-erase ' + riversPath + ' target=1 ' +
'-o precision=0.000001 format=geojson ' + landsPath + ' ' +
'-o format=shapefile ' + landsPath + ' ' +
'-verbose';
await utils.mapshaperCmd(cmd);
});
4 changes: 2 additions & 2 deletions gulp/maps/earth-rivers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const utils = require('../utils');
gulp.task('earth-rivers-generate', async () => {
const riversUrl = 'http://data.openstreetmapdata.com/river-polygons-reduced-3857.zip';

const riversPath = path.join(folders.mapsDir, 'earth-rivers.geo.json');
const riversPath = path.join(folders.mapsDir, 'earth-rivers.shp');
const tmpRiversDir = path.join(folders.tmpDir, 'earth-rivers');

const shpRiversPath = path.join(tmpRiversDir, 'river_reduced_z6.shp');
Expand All @@ -31,7 +31,7 @@ gulp.task('earth-rivers-generate', async () => {
'-filter-fields ' +
'-proj +init=epsg:4326 ' +
'-dissolve ' +
'-o precision=0.000001 format=geojson ' + riversPath + ' ' +
'-o format=shapefile ' + riversPath + ' ' +
'-verbose';
await utils.mapshaperCmd(cmd);

Expand Down
6 changes: 3 additions & 3 deletions gulp/maps/earth-seas.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ const utils = require('../utils');
* Creates a valid GeoJSON file from the OSM lakes map in the tmp folder.
*/
gulp.task('earth-seas-generate', async () => {
const coastlinesPath = path.join(folders.mapsDir, 'earth-coastlines.geo.json');
const seasPath = path.join(folders.mapsDir, 'earth-seas.geo.json');
const coastlinesPath = path.join(folders.mapsDir, 'earth-coastlines.shp');
const seasPath = path.join(folders.mapsDir, 'earth-seas.shp');

const cmd = '-rectangle bbox=-180,-90,180,90 name="bounds" ' +
'-rectangle bbox=-180,-90,180,-80 name="south-pole-fix" ' +
'-erase 2 target=1 ' +
'-drop target=2 ' +
'-erase ' + coastlinesPath + ' target=1 ' +
'-o precision=0.000001 format=geojson ' + seasPath + ' ' +
'-o format=shapefile ' + seasPath + ' ' +
'-verbose';
await utils.mapshaperCmd(cmd);
});
10 changes: 5 additions & 5 deletions gulp/maps/earth-waterbodies.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ const utils = require('../utils');
* Creates a valid GeoJSON file from the OSM lakes map in the tmp folder.
*/
gulp.task('earth-waterbodies-generate', async () => {
const watersPath = path.join(folders.mapsDir, 'earth-waterbodies.geo.json');
const lakesPath = path.join(folders.mapsDir, 'earth-lakes.geo.json');
const riversPath = path.join(folders.mapsDir, 'earth-rivers.geo.json');
const seasPath = path.join(folders.mapsDir, 'earth-seas.geo.json');
const watersPath = path.join(folders.mapsDir, 'earth-waterbodies.shp');
const lakesPath = path.join(folders.mapsDir, 'earth-lakes.shp');
const riversPath = path.join(folders.mapsDir, 'earth-rivers.shp');
const seasPath = path.join(folders.mapsDir, 'earth-seas.shp');

const cmd = '-i combine-files ' + riversPath + ' ' + lakesPath + ' ' + seasPath + ' ' +
'-merge-layers ' +
'-o precision=0.000001 format=geojson ' + watersPath + ' ' +
'-o format=shapefile ' + watersPath + ' ' +
'-verbose';
await utils.mapshaperCmd(cmd);
});
2 changes: 1 addition & 1 deletion gulp/tasks/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ gulp.task('compress', async () => {
const bar = utils.processProgress(map, Object.keys(sizes).length);

for (const size of Object.keys(sizes)) {
const mapPath = path.join(folders.mapsDir, map + '.geo.json');
const mapPath = path.join(folders.mapsDir, map + '.shp');
const outMapDir = path.join(folders.buildDir, map, size);
const outMapPath = path.join(outMapDir, 'map.geo.json');

Expand Down